|
1 | 1 | {{$file := .file}}
|
2 | 2 | {{range $j, $section := $file.Sections}}
|
3 | 3 | {{range $k, $line := $section.Lines}}
|
4 |
| - {{if or $.root.AfterCommitID (ne .GetType 4)}} |
5 |
| - <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
6 |
| - {{if eq .GetType 4}} |
| 4 | + <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
| 5 | + {{if eq .GetType 4}} |
| 6 | + {{if $.root.AfterCommitID}} |
7 | 7 | <td colspan="2" class="lines-num">
|
8 | 8 | {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
|
9 | 9 | <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
|
|
22 | 22 | {{end}}
|
23 | 23 | </td>
|
24 | 24 | {{else}}
|
25 |
| - <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> |
26 |
| - <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> |
| 25 | + {{/* for code file preview page or comment diffs on pull comment pages, do not show the expansion arrows */}} |
| 26 | + <td colspan="2" class="lines-num"></td> |
27 | 27 | {{end}}
|
28 |
| - {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale -}} |
29 |
| - <td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}</td> |
30 |
| - <td class="lines-type-marker"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> |
31 |
| - {{if eq .GetType 4}} |
32 |
| - <td class="chroma lines-code blob-hunk">{{/* |
33 |
| - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* |
34 |
| - */}}</td> |
35 |
| - {{else}} |
36 |
| - <td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/* |
37 |
| - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* |
38 |
| - */}}<a class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/* |
39 |
| - */}}{{svg "octicon-plus"}}{{/* |
40 |
| - */}}</a>{{/* |
41 |
| - */}}{{end}}{{/* |
42 |
| - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* |
43 |
| - */}}</td> |
44 |
| - {{end}} |
45 |
| - </tr> |
46 |
| - {{if gt (len $line.Comments) 0}} |
47 |
| - <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
48 |
| - <td colspan="3" class="lines-num"></td> |
49 |
| - <td class="add-comment-left add-comment-right" colspan="5"> |
50 |
| - {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
51 |
| - </td> |
52 |
| - </tr> |
| 28 | + {{else}} |
| 29 | + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> |
| 30 | + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> |
| 31 | + {{end}} |
| 32 | + {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale -}} |
| 33 | + <td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}</td> |
| 34 | + <td class="lines-type-marker"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> |
| 35 | + {{if eq .GetType 4}} |
| 36 | + <td class="chroma lines-code blob-hunk">{{/* |
| 37 | + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* |
| 38 | + */}}</td> |
| 39 | + {{else}} |
| 40 | + <td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/* |
| 41 | + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* |
| 42 | + */}}<a class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/* |
| 43 | + */}}{{svg "octicon-plus"}}{{/* |
| 44 | + */}}</a>{{/* |
| 45 | + */}}{{end}}{{/* |
| 46 | + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* |
| 47 | + */}}</td> |
53 | 48 | {{end}}
|
| 49 | + </tr> |
| 50 | + {{if gt (len $line.Comments) 0}} |
| 51 | + <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
| 52 | + <td colspan="3" class="lines-num"></td> |
| 53 | + <td class="add-comment-left add-comment-right" colspan="5"> |
| 54 | + {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
| 55 | + </td> |
| 56 | + </tr> |
54 | 57 | {{end}}
|
55 | 58 | {{end}}
|
56 | 59 | {{end}}
|
0 commit comments