aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/diff/blob_excerpt.tmpl
diff options
context:
space:
mode:
authorBenno <blueworrybear@gmail.com>2019-11-15 10:52:59 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2019-11-15 10:52:59 +0800
commit149a9df9e8e7e91c813232fb82e644b0d3369b09 (patch)
treecfb677cde7578ad448a201224522c50b227a6097 /templates/repo/diff/blob_excerpt.tmpl
parent42ada741e3360b14ede8772aa1a2dd3e83209033 (diff)
downloadgitea-149a9df9e8e7e91c813232fb82e644b0d3369b09.tar.gz
gitea-149a9df9e8e7e91c813232fb82e644b0d3369b09.zip
Expand/Collapse Files and Blob Excerpt while Reviewing/Comparing code (#8924)
* update #8659 fold/unfold code diffs * add fold button style * update #8659 implement expand up/down codes (blob excerpt) * fix golint errors * fix expand direction * remove debug message * update css style for blob exceprt * fix typo in comment * update style sheet with less * update expect diff (add SectionInfo) * update #8942 accept suggested change (fix typo) * close reader and check file type before get tail section * adjust button position and check file type before insert fold button * move index js to web_src * merge index.js with master * generate index.js * update js coding style
Diffstat (limited to 'templates/repo/diff/blob_excerpt.tmpl')
-rw-r--r--templates/repo/diff/blob_excerpt.tmpl50
1 files changed, 50 insertions, 0 deletions
diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl
new file mode 100644
index 0000000000..5f0cd30bb7
--- /dev/null
+++ b/templates/repo/diff/blob_excerpt.tmpl
@@ -0,0 +1,50 @@
+{{if $.IsSplitStyle}}
+ {{range $k, $line := $.section.Lines}}
+ <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
+ {{if eq .GetType 4}}
+ <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}">
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+ <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+ <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 2)}}
+ <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ </td>
+ <td colspan="5" class="lines-code lines-code-old "><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{$.section.GetComputedInlineDiffFor $line}}</span></td>
+ {{else}}
+ <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $.fileName}}L{{$line.LeftIdx}}{{end}}"></span></td>
+ <td class="blob-excerpt lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker=""></span>{{end}}</td>
+ <td class="blob-excerpt lines-code lines-code-old halfwidth"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$.section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+ <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $.fileName}}R{{$line.RightIdx}}{{end}}"></span></td>
+ <td class="blob-excerpt lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker=""></span>{{end}}</td>
+ <td class="blob-excerpt lines-code lines-code-new halfwidth"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$.section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
+ {{end}}
+ </tr>
+ {{end}}
+{{else}}
+ {{range $k, $line := $.section.Lines}}
+ <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
+ {{if eq .GetType 4}}
+ <td colspan="2" class="lines-num">
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+ <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+ <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 2)}}
+ <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.RepoLink}}/blob_excerpt/{{$.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="{{$.Anchor}}"></i>
+ {{end}}
+ </td>
+ {{else}}
+ <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $.fileName}}L{{$line.LeftIdx}}{{end}}"></span></td>
+ <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $.fileName}}R{{$line.RightIdx}}{{end}}"></span></td>
+ {{end}}
+ <td class="blob-excerpt lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
+ <td class="blob-excerpt lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><span class="mono wrap{{if $.highlightClass}} language-{{$.highlightClass}}{{else}} nohighlight{{end}}">{{$.section.GetComputedInlineDiffFor $line}}</span></td>
+ </tr>
+ {{end}}
+{{end}} \ No newline at end of file