overleaf/services/web/public/coffee/history/HistoryView.coffee

40 lines
922 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
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()
)
}]