|
1 | | -{{$blobExcerptLink := print $.RepoLink (Iif $.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $.AfterCommitID) (QueryBuild "?" "anchor" $.Anchor)}} |
| 1 | +{{$blobExcerptLink := print $.RepoLink (Iif $.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $.AfterCommitID) "?" (Iif $.PageIsPullFiles (print "is_pull=true&issue_index=" $.IssueIndex "&") "")}} |
2 | 2 | {{if $.IsSplitStyle}} |
3 | 3 | {{range $k, $line := $.section.Lines}} |
4 | | - <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded"> |
| 4 | + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}"> |
5 | 5 | {{if eq .GetType 4}} |
6 | 6 | {{$expandDirection := $line.GetExpandDirection}} |
7 | 7 | <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"> |
8 | 8 | <div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}"> |
9 | 9 | {{if or (eq $expandDirection 3) (eq $expandDirection 5)}} |
10 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=split&direction=down"> |
| 10 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=split&direction=down"> |
11 | 11 | {{svg "octicon-fold-down"}} |
12 | 12 | </button> |
13 | 13 | {{end}} |
14 | 14 | {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} |
15 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=split&direction=up"> |
| 15 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=split&direction=up"> |
16 | 16 | {{svg "octicon-fold-up"}} |
17 | 17 | </button> |
18 | 18 | {{end}} |
19 | 19 | {{if eq $expandDirection 2}} |
20 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=split"> |
| 20 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=split"> |
21 | 21 | {{svg "octicon-fold"}} |
22 | 22 | </button> |
23 | 23 | {{end}} |
|
33 | 33 | <td class="lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> |
34 | 34 | <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> |
35 | 35 | <td class="lines-code lines-code-old"> |
| 36 | + {{- if and $.SignedUserID $.PageIsPullFiles $line.LeftIdx -}} |
| 37 | + <button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}"> |
| 38 | + {{- svg "octicon-plus" -}} |
| 39 | + </button> |
| 40 | + {{- end -}} |
36 | 41 | {{- if $line.LeftIdx -}} |
37 | 42 | {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} |
38 | 43 | {{- else -}} |
|
43 | 48 | <td class="lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> |
44 | 49 | <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> |
45 | 50 | <td class="lines-code lines-code-new"> |
| 51 | + {{- if and $.SignedUserID $.PageIsPullFiles $line.RightIdx -}} |
| 52 | + <button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}"> |
| 53 | + {{- svg "octicon-plus" -}} |
| 54 | + </button> |
| 55 | + {{- end -}} |
46 | 56 | {{- if $line.RightIdx -}} |
47 | 57 | {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} |
48 | 58 | {{- else -}} |
|
51 | 61 | </td> |
52 | 62 | {{end}} |
53 | 63 | </tr> |
| 64 | + {{if $line.Comments}} |
| 65 | + <tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}"> |
| 66 | + <td class="add-comment-left" colspan="4"> |
| 67 | + {{if eq $line.GetCommentSide "previous"}} |
| 68 | + {{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}} |
| 69 | + {{end}} |
| 70 | + </td> |
| 71 | + <td class="add-comment-right" colspan="4"> |
| 72 | + {{if eq $line.GetCommentSide "proposed"}} |
| 73 | + {{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}} |
| 74 | + {{end}} |
| 75 | + </td> |
| 76 | + </tr> |
| 77 | + {{end}} |
54 | 78 | {{end}} |
55 | 79 | {{else}} |
56 | 80 | {{range $k, $line := $.section.Lines}} |
57 | | - <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded"> |
| 81 | + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}"> |
58 | 82 | {{if eq .GetType 4}} |
59 | 83 | {{$expandDirection := $line.GetExpandDirection}} |
60 | 84 | <td colspan="2" class="lines-num"> |
61 | 85 | <div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}"> |
62 | 86 | {{if or (eq $expandDirection 3) (eq $expandDirection 5)}} |
63 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=unified&direction=down"> |
| 87 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=unified&direction=down"> |
64 | 88 | {{svg "octicon-fold-down"}} |
65 | 89 | </button> |
66 | 90 | {{end}} |
67 | 91 | {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} |
68 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=unified&direction=up"> |
| 92 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=unified&direction=up"> |
69 | 93 | {{svg "octicon-fold-up"}} |
70 | 94 | </button> |
71 | 95 | {{end}} |
72 | 96 | {{if eq $expandDirection 2}} |
73 | | - <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}&{{$line.GetBlobExcerptQuery}}&style=unified"> |
| 97 | + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptLink}}{{$line.GetBlobExcerptQuery}}&style=unified"> |
74 | 98 | {{svg "octicon-fold"}} |
75 | 99 | </button> |
76 | 100 | {{end}} |
|
83 | 107 | {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} |
84 | 108 | <td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> |
85 | 109 | <td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> |
86 | | - <td class="lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><code {{if $inlineDiff.EscapeStatus.Escaped}}class="code-inner has-escaped" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"{{else}}class="code-inner"{{end}}>{{$inlineDiff.Content}}</code></td> |
| 110 | + <td class="lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"> |
| 111 | + {{- if and $.SignedUserID $.PageIsPullFiles -}} |
| 112 | + <button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}"> |
| 113 | + {{- svg "octicon-plus" -}} |
| 114 | + </button> |
| 115 | + {{- end -}} |
| 116 | + <code {{if $inlineDiff.EscapeStatus.Escaped}}class="code-inner has-escaped" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"{{else}}class="code-inner"{{end}}>{{$inlineDiff.Content}}</code> |
| 117 | + </td> |
87 | 118 | </tr> |
| 119 | + {{if $line.Comments}} |
| 120 | + <tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}"> |
| 121 | + <td class="add-comment-left add-comment-right" colspan="5"> |
| 122 | + {{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}} |
| 123 | + </td> |
| 124 | + </tr> |
| 125 | + {{end}} |
88 | 126 | {{end}} |
89 | 127 | {{end}} |
0 commit comments