mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-18 03:23:42 -05:00
26 lines
664 B
CoffeeScript
26 lines
664 B
CoffeeScript
ModalView = require 'views/core/ModalView'
|
|
template = require 'templates/modal/revert-modal'
|
|
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
|