mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 15:00:48 +00:00
29 lines
670 B
CoffeeScript
29 lines
670 B
CoffeeScript
|
define [
|
||
|
"./util"
|
||
|
"history/FileDiff"
|
||
|
"history/FileDiffView"
|
||
|
"libs/mustache"
|
||
|
"libs/backbone"
|
||
|
], (util, FileDiff, FileDiffView)->
|
||
|
VersionView = Backbone.View.extend
|
||
|
template : $("#diffTemplate").html()
|
||
|
|
||
|
render: ->
|
||
|
html = Mustache.to_html(@template, @modelView())
|
||
|
@$el = $("#diffViewArea")
|
||
|
|
||
|
@$el.empty()
|
||
|
@$el.append html
|
||
|
|
||
|
for fileDiff in @model.get("file_diffs")
|
||
|
model = new FileDiff(_.extend(fileDiff, version_id: @model.get("id")))
|
||
|
view = new FileDiffView model: model
|
||
|
@$el.append view.render().el
|
||
|
|
||
|
return this
|
||
|
|
||
|
modelView: ->
|
||
|
modelView = @model.toJSON()
|
||
|
modelView.date = util.formatDate(modelView.date)
|
||
|
return modelView
|