aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/diff
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-06-24 21:23:52 +0100
committerGitHub <noreply@github.com>2019-06-24 21:23:52 +0100
commit5908bb103003912bd0ba3cefa66f2ff815ee8d8e (patch)
treeec0f4ff99314aa4e38334b436e1aea287b27cb7b /templates/repo/diff
parente07ff2f89064db8fa5c78a2a27a69d93183d10a4 (diff)
downloadgitea-5908bb103003912bd0ba3cefa66f2ff815ee8d8e.tar.gz
gitea-5908bb103003912bd0ba3cefa66f2ff815ee8d8e.zip
Make diff line-marker non-selectable (#7279)
* Make diff line-marker non-selectable * Move to use data-* as per @mrsdizzie * fix missing line nums * Add a minimum-width to force right-align of the line num * Move line-type-marker into separate column
Diffstat (limited to 'templates/repo/diff')
-rw-r--r--templates/repo/diff/box.tmpl17
-rw-r--r--templates/repo/diff/section_unified.tmpl12
2 files changed, 20 insertions, 9 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 2bdf9e5881..94ac094fa4 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -120,8 +120,11 @@
{{range $j, $section := $file.Sections}}
{{range $k, $line := $section.Lines}}
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
- <td class="lines-num lines-num-old">
- <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
+ <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-type-marker">
+ <pre>{{if $line.LeftIdx}}<span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</pre>
</td>
<td class="lines-code lines-code-old halfwidth">
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}
@@ -129,10 +132,12 @@
{{end}}
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
</td>
- <td class="lines-num lines-num-new">
- <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
+ <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>
+ <td class="lines-type-marker">
+ <pre>{{if $line.RightIdx}}<span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</pre>
</td>
-
<td class="lines-code lines-code-new halfwidth">
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
@@ -143,6 +148,7 @@
{{if gt (len $line.Comments) 0}}
<tr class="add-code-comment">
<td class="lines-num"></td>
+ <td class="lines-type-marker"></td>
<td class="add-comment-left">
{{if eq $line.GetCommentSide "previous"}}
<div class="field comment-code-cloud">
@@ -156,6 +162,7 @@
{{end}}
</td>
<td class="lines-num"></td>
+ <td class="lines-type-marker"></td>
<td class="add-comment-right">
{{if eq $line.GetCommentSide "proposed"}}
<div class="field comment-code-cloud">
diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl
index 53ccaedbc2..5706e4cdee 100644
--- a/templates/repo/diff/section_unified.tmpl
+++ b/templates/repo/diff/section_unified.tmpl
@@ -8,13 +8,16 @@
{{/* {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}}
</td>
{{else}}
- <td class="lines-num lines-num-old">
- <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
+ <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">
- <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
+ <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>
{{end}}
+ <td class="lines-type-marker">
+ <pre><span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span></pre>
+ </td>
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}
<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a>
@@ -25,6 +28,7 @@
{{if gt (len $line.Comments) 0}}
<tr>
<td colspan="2" class="lines-num"></td>
+ <td class="lines-type-marker"></td>
<td class="add-comment-left add-comment-right">
<div class="field comment-code-cloud">
<div class="comment-list">