overleaf/services/web/public/coffee/history/HistoryView.coffee
2014-02-12 10:23:40 +00:00

39 lines
922 B
CoffeeScript

define [
"utils/Modal"
"libs/backbone"
], (Modal) ->
HistoryView = Backbone.View.extend
template : $("#revisionAreaTemplate").html()
events :
"click #enableVersioning" : "enableVersioning"
"click #take-snapshot" : "takeSnapshot"
render : ->
@$el.html(@template)
return this
setHistoryAreaToDisplayHistory: ->
@$("#historyAreaWrapper").show()
@$("#enableVersioningMessage").hide()
setHistoryAreaToDisplayEnableVersioning: ->
@$("#historyAreaWrapper").hide()
@$("#enableVersioningMessage").show()
enableVersioning: -> @options.manager.enableVersioning()
takeSnapshot: ->
Modal.createModal
title: "Snapshot comment"
message: $("#snapshotCommentTemplate").html()
buttons: [{
text: "Cancel"
},{
text: "Take Snapshot"
class: "btn-primary"
callback: () =>
@options.manager.takeSnapshot(
$("#snapshotComment").val()
)
}]