aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/diff/section_unified.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/section_unified.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/section_unified.tmpl')
-rw-r--r--templates/repo/diff/section_unified.tmpl14
1 files changed, 11 insertions, 3 deletions
diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl
index 9a60c238dc..fcc511af75 100644
--- a/templates/repo/diff/section_unified.tmpl
+++ b/templates/repo/diff/section_unified.tmpl
@@ -4,9 +4,17 @@
{{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 gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}}
- </td>
+ <td colspan="2" class="lines-num">
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+ <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+ <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 2)}}
+ <i class="ui blob-excerpt octicon octicon-fold" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></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 $file.Name}}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 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>