mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-04 21:01:06 -05:00
26 lines
659 B
CoffeeScript
26 lines
659 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()
|
|
@reloadOnClose = true
|
|
|
|
getRenderData: ->
|
|
c = super()
|
|
models = _.values CocoModel.backedUp
|
|
models = (m for m in models when m.hasLocalChanges())
|
|
c.models = models
|
|
c
|
|
|
|
onHidden: ->
|
|
location.reload() if @reloadOnClose
|