Skip to content

Commit 6d59c2f

Browse files
committed
Full back functionality implemented and it's not even a little dumb
1 parent 9e85730 commit 6d59c2f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/coffee/phrasebook/models/PresentationModel.coffee

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ class phrasebook.models.PresentationModel extends Backbone.Model
1414

1515
goBack: ->
1616
@get('previouslyVisitedOptions').pop()
17-
lastOption = @get('previouslyVisitedOptions').last()
18-
@set('currentlyVisibleOptions', new Backbone.Collection(lastOption.get('children')))
17+
if (@get('previouslyVisitedOptions').isEmpty())
18+
@set('currentlyVisibleOptions', new Backbone.Collection(_.values(@tree)))
19+
else
20+
lastOption = @get('previouslyVisitedOptions').last()
21+
@set('currentlyVisibleOptions', new Backbone.Collection(lastOption.get('children')))
1922

2023
parseJSONTree: (tree) ->
2124
for nodeID, children of tree

0 commit comments

Comments
 (0)