mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
24 lines
590 B
CoffeeScript
24 lines
590 B
CoffeeScript
|
ModalView = require 'views/kinds/ModalView'
|
||
|
template = require 'templates/modal/revert'
|
||
|
CocoModel = require 'models/CocoModel'
|
||
|
|
||
|
module.exports = class RevertModal extends ModalView
|
||
|
id: 'revert-modal'
|
||
|
template: template
|
||
|
|
||
|
events:
|
||
|
'click #changed-models button': 'onRevertModel'
|
||
|
|
||
|
onRevertModel: (e) ->
|
||
|
id = $(e.target).val()
|
||
|
CocoModel.backedUp[id].revert()
|
||
|
$(e.target).closest('tr').remove()
|
||
|
|
||
|
getRenderData: ->
|
||
|
c = super()
|
||
|
models = _.values CocoModel.backedUp
|
||
|
models = (m for m in models when m.hasLocalChanges())
|
||
|
c.models = models
|
||
|
c
|
||
|
|