mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -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 #recalculate-button': 'confirmRecalculation'
|
||||||
'click #delete-button': 'confirmDeletion'
|
'click #delete-button': 'confirmDeletion'
|
||||||
|
|
||||||
subscriptions:
|
|
||||||
'save-new': 'saveAchievement'
|
|
||||||
|
|
||||||
constructor: (options, @achievementID) ->
|
constructor: (options, @achievementID) ->
|
||||||
super options
|
super options
|
||||||
@achievement = new Achievement(_id: @achievementID)
|
@achievement = new Achievement(_id: @achievementID)
|
||||||
|
|
|
@ -61,6 +61,15 @@ module.exports = class SettingsTabView extends CocoView
|
||||||
if (terrain = @settingsTreema.data.terrain) isnt @lastTerrain
|
if (terrain = @settingsTreema.data.terrain) isnt @lastTerrain
|
||||||
@lastTerrain = terrain
|
@lastTerrain = terrain
|
||||||
Backbone.Mediator.publish 'editor:terrain-changed', terrain: 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) ->
|
onThangsEdited: (e) ->
|
||||||
# Update in-place so existing Treema nodes refer to the same array.
|
# Update in-place so existing Treema nodes refer to the same array.
|
||||||
|
|
Loading…
Reference in a new issue