mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 14:13:26 +00:00
Show blank diff for files that haven't changed
This commit is contained in:
parent
2a3e7ba9f3
commit
5f8ed42006
3 changed files with 15 additions and 11 deletions
|
@ -20,6 +20,17 @@ define [
|
||||||
render: ->
|
render: ->
|
||||||
diff = @model.get("diff")
|
diff = @model.get("diff")
|
||||||
return unless diff?
|
return unless diff?
|
||||||
|
|
||||||
|
changes = @getNumberOfChanges()
|
||||||
|
html = Mustache.to_html @template, {
|
||||||
|
changes: "#{changes} change#{if changes == 1 then "" else "s"}"
|
||||||
|
name: @model.get("doc")?.get("name")
|
||||||
|
}
|
||||||
|
@$el.html(html)
|
||||||
|
|
||||||
|
if !@model.get("from")? or !@model.get("to")? or changes == 0
|
||||||
|
@$(".restore").hide()
|
||||||
|
|
||||||
@createAceEditor()
|
@createAceEditor()
|
||||||
@aceEditor.setValue(@getPlainDiffContent())
|
@aceEditor.setValue(@getPlainDiffContent())
|
||||||
@aceEditor.clearSelection()
|
@aceEditor.clearSelection()
|
||||||
|
@ -36,12 +47,6 @@ define [
|
||||||
@undelegateEvents()
|
@undelegateEvents()
|
||||||
|
|
||||||
createAceEditor: () ->
|
createAceEditor: () ->
|
||||||
changes = @getNumberOfChanges()
|
|
||||||
html = Mustache.to_html @template, {
|
|
||||||
changes: "#{changes} change#{if changes > 1 then "s" else ""}"
|
|
||||||
name: @model.get("doc")?.get("name")
|
|
||||||
}
|
|
||||||
@$el.html(html)
|
|
||||||
@$editor = @$(".track-changes-diff-editor")
|
@$editor = @$(".track-changes-diff-editor")
|
||||||
@$el.append(@$editor)
|
@$el.append(@$editor)
|
||||||
@aceEditor = Ace.edit(@$editor[0])
|
@aceEditor = Ace.edit(@$editor[0])
|
||||||
|
|
|
@ -113,10 +113,6 @@ define [
|
||||||
|
|
||||||
{from, to, start_ts, end_ts} = @_findDocVersionsRangeInSelection(@doc_id, fromIndex, toIndex)
|
{from, to, start_ts, end_ts} = @_findDocVersionsRangeInSelection(@doc_id, fromIndex, toIndex)
|
||||||
|
|
||||||
if !from? or !to?
|
|
||||||
console.log "No diff, should probably just show latest version"
|
|
||||||
return
|
|
||||||
|
|
||||||
@diff = new Diff({
|
@diff = new Diff({
|
||||||
project_id: @project_id
|
project_id: @project_id
|
||||||
doc_id: @doc_id
|
doc_id: @doc_id
|
||||||
|
|
|
@ -8,7 +8,10 @@ define [
|
||||||
@set "doc", @ide.fileTreeManager.getEntity(@get("doc_id"))
|
@set "doc", @ide.fileTreeManager.getEntity(@get("doc_id"))
|
||||||
|
|
||||||
url: () ->
|
url: () ->
|
||||||
"/project/#{@get("project_id")}/doc/#{@get("doc_id")}/diff?from=#{@get("from")}&to=#{@get("to")}"
|
url = "/project/#{@get("project_id")}/doc/#{@get("doc_id")}/diff"
|
||||||
|
if @get("from")? and @get("to")?
|
||||||
|
url += "?from=#{@get("from")}&to=#{@get("to")}"
|
||||||
|
return url
|
||||||
|
|
||||||
parse: (diff) ->
|
parse: (diff) ->
|
||||||
for entry in diff.diff
|
for entry in diff.diff
|
||||||
|
|
Loading…
Reference in a new issue