|
1 | 1 | {{$file := .file}}
|
2 | 2 | {{range $j, $section := $file.Sections}}
|
3 | 3 | {{range $k, $line := $section.Lines}}
|
4 |
| - <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
5 |
| - {{if eq .GetType 4}} |
6 |
| - <td class="lines-num lines-num-old"> |
7 |
| - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }} |
8 |
| - <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
9 |
| - {{svg "octicon-fold-down"}} |
10 |
| - </a> |
11 |
| - {{end}} |
12 |
| - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }} |
13 |
| - <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
14 |
| - {{svg "octicon-fold-up"}} |
15 |
| - </a> |
16 |
| - {{end}} |
17 |
| - {{if eq $line.GetExpandDirection 2}} |
18 |
| - <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
19 |
| - {{svg "octicon-fold"}} |
20 |
| - </a> |
21 |
| - {{end}} |
22 |
| - </td> |
23 |
| - <td colspan="5" class="lines-code lines-code-old "><code class="code-inner">{{$section.GetComputedInlineDiffFor $line}}</span></td> |
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-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td> |
26 |
| - <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> |
27 |
| - <td class="lines-code lines-code-old halfwidth">{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td> |
28 |
| - <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> |
29 |
| - <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> |
30 |
| - <td class="lines-code lines-code-new halfwidth">{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td> |
31 |
| - {{end}} |
32 |
| - </tr> |
33 |
| - {{if gt (len $line.Comments) 0}} |
34 |
| - <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
35 |
| - <td class="lines-num"></td> |
36 |
| - <td class="lines-type-marker"></td> |
37 |
| - <td class="add-comment-left"> |
38 |
| - {{if eq $line.GetCommentSide "previous"}} |
39 |
| - {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
40 |
| - {{end}} |
41 |
| - </td> |
42 |
| - <td class="lines-num"></td> |
43 |
| - <td class="lines-type-marker"></td> |
44 |
| - <td class="add-comment-right"> |
45 |
| - {{if eq $line.GetCommentSide "proposed"}} |
46 |
| - {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
47 |
| - {{end}} |
48 |
| - </td> |
| 4 | + {{$hasmatch := ne $line.Match -1}} |
| 5 | + {{if or (ne .GetType 2) (not $hasmatch)}} |
| 6 | + <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
| 7 | + {{if eq .GetType 4}} |
| 8 | + <td class="lines-num lines-num-old"> |
| 9 | + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }} |
| 10 | + <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
| 11 | + {{svg "octicon-fold-down"}} |
| 12 | + </a> |
| 13 | + {{end}} |
| 14 | + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }} |
| 15 | + <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
| 16 | + {{svg "octicon-fold-up"}} |
| 17 | + </a> |
| 18 | + {{end}} |
| 19 | + {{if eq $line.GetExpandDirection 2}} |
| 20 | + <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"> |
| 21 | + {{svg "octicon-fold"}} |
| 22 | + </a> |
| 23 | + {{end}} |
| 24 | + </td> |
| 25 | + <td colspan="5" class="lines-code lines-code-old "><code class="code-inner">{{$section.GetComputedInlineDiffFor $line}}</span></td> |
| 26 | + {{else if and (eq .GetType 3) $hasmatch}}{{/* DEL */}} |
| 27 | + {{$match := index $section.Lines $line.Match}} |
| 28 | + <td class="lines-num lines-num-old del-code" data-line-num="{{$line.LeftIdx}}"><span rel="diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}"></span></td> |
| 29 | + <td class="lines-type-marker lines-type-marker-old del-code"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> |
| 30 | + <td class="lines-code lines-code-old halfwidth del-code">{{if and $.root.SignedUserID $.root.PageIsPullFiles}}<a class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td> |
| 31 | + <td class="lines-num lines-num-new add-code" data-line-num="{{if $match.RightIdx}}{{$match.RightIdx}}{{end}}"><span rel="{{if $match.RightIdx}}diff-{{Sha1 $file.Name}}R{{$match.RightIdx}}{{end}}"></span></td> |
| 32 | + <td class="lines-type-marker lines-type-marker-new add-code">{{if $match.RightIdx}}<span class="mono" data-type-marker="{{$match.GetLineTypeMarker}}"></span>{{end}}</td> |
| 33 | + <td class="lines-code lines-code-new halfwidth add-code">{{if and $.root.SignedUserID $.root.PageIsPullFiles}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $match.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="right" data-idx="{{$match.RightIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $match.RightIdx}}{{$section.GetComputedInlineDiffFor $match}}{{end}}</code></td> |
| 34 | + {{else}} |
| 35 | + <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> |
| 36 | + <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> |
| 37 | + <td class="lines-code lines-code-old halfwidth">{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td> |
| 38 | + <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> |
| 39 | + <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> |
| 40 | + <td class="lines-code lines-code-new halfwidth">{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td> |
| 41 | + {{end}} |
49 | 42 | </tr>
|
| 43 | + {{if gt (len $line.Comments) 0}} |
| 44 | + <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> |
| 45 | + <td class="lines-num"></td> |
| 46 | + <td class="lines-type-marker"></td> |
| 47 | + <td class="add-comment-left"> |
| 48 | + {{if eq $line.GetCommentSide "previous"}} |
| 49 | + {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
| 50 | + {{end}} |
| 51 | + </td> |
| 52 | + <td class="lines-num"></td> |
| 53 | + <td class="lines-type-marker"></td> |
| 54 | + <td class="add-comment-right"> |
| 55 | + {{if eq $line.GetCommentSide "proposed"}} |
| 56 | + {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} |
| 57 | + {{end}} |
| 58 | + </td> |
| 59 | + </tr> |
| 60 | + {{end}} |
| 61 | + {{if and (eq .GetType 3) $hasmatch}} |
| 62 | + {{$match := index $section.Lines $line.Match}} |
| 63 | + {{if gt (len $match.Comments) 0}} |
| 64 | + <tr class="add-comment" data-line-type="add"> |
| 65 | + <td class="lines-num"></td> |
| 66 | + <td class="lines-type-marker"></td> |
| 67 | + <td class="add-comment-left"> |
| 68 | + {{if eq $match.GetCommentSide "previous"}} |
| 69 | + {{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}} |
| 70 | + {{end}} |
| 71 | + </td> |
| 72 | + <td class="lines-num"></td> |
| 73 | + <td class="lines-type-marker"></td> |
| 74 | + <td class="add-comment-right"> |
| 75 | + {{if eq $match.GetCommentSide "proposed"}} |
| 76 | + {{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}} |
| 77 | + {{end}} |
| 78 | + </td> |
| 79 | + </tr> |
| 80 | + {{end}} |
| 81 | + {{end}} |
50 | 82 | {{end}}
|
51 | 83 | {{end}}
|
52 | 84 | {{end}}
|
0 commit comments