mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Adding default IDs to new goals.
This commit is contained in:
parent
3fd9cb89ef
commit
23516175d4
2 changed files with 9 additions and 3 deletions
|
@ -15,9 +15,6 @@ module.exports = class AchievementEditView extends RootView
|
|||
'click #recalculate-button': 'confirmRecalculation'
|
||||
'click #delete-button': 'confirmDeletion'
|
||||
|
||||
subscriptions:
|
||||
'save-new': 'saveAchievement'
|
||||
|
||||
constructor: (options, @achievementID) ->
|
||||
super options
|
||||
@achievement = new Achievement(_id: @achievementID)
|
||||
|
|
|
@ -61,6 +61,15 @@ module.exports = class SettingsTabView extends CocoView
|
|||
if (terrain = @settingsTreema.data.terrain) isnt @lastTerrain
|
||||
@lastTerrain = terrain
|
||||
Backbone.Mediator.publish 'editor:terrain-changed', terrain: terrain
|
||||
for goal, index in @settingsTreema.data.goals ? []
|
||||
continue if goal.id
|
||||
goalIndex = index
|
||||
goalID = "goal-#{goalIndex}"
|
||||
goalID = "goal-#{++goalIndex}" while _.find @settingsTreema.get("goals"), id: goalID
|
||||
@settingsTreema.disableTracking()
|
||||
@settingsTreema.set "/goals/#{index}/id", goalID
|
||||
@settingsTreema.set "/goals/#{index}/name", _.string.humanize goalID
|
||||
@settingsTreema.enableTracking()
|
||||
|
||||
onThangsEdited: (e) ->
|
||||
# Update in-place so existing Treema nodes refer to the same array.
|
||||
|
|
Loading…
Reference in a new issue