add a self-serve restore modal for users who want to restore their stats

This commit is contained in:
Tyler Renelle
2013-02-27 09:07:51 -05:00
parent 203e0a124a
commit 01182b377d
2 changed files with 60 additions and 1 deletions
+8
View File
@@ -72,6 +72,14 @@ module.exports.app = (appExports, model) ->
appExports.customizeArmorSet = (e, el) ->
user.set 'preferences.armorSet', $(el).attr('data-value')
appExports.restoreSave = (e, el) ->
batch = new BatchUpdate(model)
batch.startTransaction()
obj = batch.obj()
_.each obj.stats, (stat, key) -> batch.set("stats.#{key}", parseInt(stat))
_.each obj.items, (item, key) -> batch.set("items.#{key}", parseInt(item))
batch.commit()
user.on 'set', 'flags.customizationsNotification', (captures, args) ->
return unless captures == true
$('.main-avatar').popover('destroy') #remove previous popovers