Skip to content

Commit b90c4e2

Browse files
committed
improve
1 parent 053df15 commit b90c4e2

File tree

7 files changed

+33
-38
lines changed

7 files changed

+33
-38
lines changed

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
</a>
2020
{{end}}
2121
</td>
22-
<td colspan="5" class="lines-code lines-code-old ">{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/*
22+
<td colspan="7" class="lines-code lines-code-old ">{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/*
2323
*/}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}</td>
2424
{{else}}
2525
{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}
2626
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$.FileNameHash}}L{{$line.LeftIdx}}{{end}}"></span></td>
2727
<td class="blob-excerpt lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"></a>{{end}}</td>
2828
<td class="blob-excerpt lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="gt-mono" data-type-marker=""></span>{{end}}</td>
29-
<td class="blob-excerpt lines-code lines-code-old halfwidth">{{/*
29+
<td class="blob-excerpt lines-code lines-code-old">{{/*
3030
*/}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/*
3131
*/}}<code class="code-inner"></code>{{/*
3232
*/}}{{end}}{{/*
3333
*/}}</td>
3434
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$.FileNameHash}}R{{$line.RightIdx}}{{end}}"></span></td>
3535
<td class="blob-excerpt lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.locale}}"></a>{{end}}</td>
3636
<td class="blob-excerpt lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="gt-mono" data-type-marker=""></span>{{end}}</td>
37-
<td class="blob-excerpt lines-code lines-code-new halfwidth">{{/*
37+
<td class="blob-excerpt lines-code lines-code-new">{{/*
3838
*/}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/*
3939
*/}}<code class="code-inner"></code>{{/*
4040
*/}}{{end}}{{/*

templates/repo/diff/section_split.tmpl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{{$file := .file}}
2+
<colgroup>
3+
<col width="50">
4+
<col width="10">
5+
<col width="10">
6+
<col>
7+
<col width="50">
8+
<col width="10">
9+
<col width="10">
10+
<col>
11+
</colgroup>
212
{{range $j, $section := $file.Sections}}
313
{{range $k, $line := $section.Lines}}
414
{{$hasmatch := ne $line.Match -1}}
@@ -33,7 +43,7 @@
3343
<td class="lines-num lines-num-old del-code" data-line-num="{{$line.LeftIdx}}"><span rel="diff-{{$file.NameHash}}L{{$line.LeftIdx}}"></span></td>
3444
<td class="lines-escape del-code lines-escape-old">{{if $line.LeftIdx}}{{if $leftDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $leftDiff "locale" $.root.locale}}"></a>{{end}}{{end}}</td>
3545
<td class="lines-type-marker lines-type-marker-old del-code"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
36-
<td class="lines-code lines-code-old halfwidth del-code">{{/*
46+
<td class="lines-code lines-code-old del-code">{{/*
3747
*/}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/*
3848
*/}}<a class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">{{/*
3949
*/}}{{svg "octicon-plus"}}{{/*
@@ -48,7 +58,7 @@
4858
<td class="lines-num lines-num-new add-code" data-line-num="{{if $match.RightIdx}}{{$match.RightIdx}}{{end}}"><span rel="{{if $match.RightIdx}}diff-{{$file.NameHash}}R{{$match.RightIdx}}{{end}}"></span></td>
4959
<td class="lines-escape add-code lines-escape-new">{{if $match.RightIdx}}{{if $rightDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $rightDiff "locale" $.root.locale}}"></a>{{end}}{{end}}</td>
5060
<td class="lines-type-marker lines-type-marker-new add-code">{{if $match.RightIdx}}<span class="gt-mono" data-type-marker="{{$match.GetLineTypeMarker}}"></span>{{end}}</td>
51-
<td class="lines-code lines-code-new halfwidth add-code">{{/*
61+
<td class="lines-code lines-code-new add-code">{{/*
5262
*/}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/*
5363
*/}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $match.CanComment)}} invisible{{end}}" data-side="right" data-idx="{{$match.RightIdx}}">{{/*
5464
*/}}{{svg "octicon-plus"}}{{/*
@@ -65,7 +75,7 @@
6575
<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>
6676
<td class="lines-escape lines-escape-old">{{if $line.LeftIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}{{end}}</td>
6777
<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
68-
<td class="lines-code lines-code-old halfwidth">{{/*
78+
<td class="lines-code lines-code-old">{{/*
6979
*/}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}{{/*
7080
*/}}<a class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">{{/*
7181
*/}}{{svg "octicon-plus"}}{{/*
@@ -80,7 +90,7 @@
8090
<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>
8191
<td class="lines-escape lines-escape-new">{{if $line.RightIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}{{end}}</td>
8292
<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
83-
<td class="lines-code lines-code-new halfwidth">{{/*
93+
<td class="lines-code lines-code-new">{{/*
8494
*/}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}{{/*
8595
*/}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">{{/*
8696
*/}}{{svg "octicon-plus"}}{{/*
@@ -98,9 +108,6 @@
98108
{{$match := index $section.Lines $line.Match}}
99109
{{if or (gt (len $line.Comments) 0) (gt (len $match.Comments) 0)}}
100110
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
101-
<td class="lines-num"></td>
102-
<td class="lines-escape"></td>
103-
<td class="lines-type-marker"></td>
104111
<td class="add-comment-left" colspan="4">
105112
{{if gt (len $line.Comments) 0}}
106113
{{if eq $line.GetCommentSide "previous"}}
@@ -113,9 +120,6 @@
113120
{{end}}
114121
{{end}}
115122
</td>
116-
<td class="lines-num"></td>
117-
<td class="lines-escape"></td>
118-
<td class="lines-type-marker"></td>
119123
<td class="add-comment-right" colspan="4">
120124
{{if eq $line.GetCommentSide "proposed"}}
121125
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
@@ -130,19 +134,13 @@
130134
{{end}}
131135
{{else if gt (len $line.Comments) 0}}
132136
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
133-
<td class="lines-num"></td>
134-
<td class="lines-escape"></td>
135-
<td class="lines-type-marker"></td>
136137
<td class="add-comment-left" colspan="4">
137138
{{if gt (len $line.Comments) 0}}
138139
{{if eq $line.GetCommentSide "previous"}}
139140
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
140141
{{end}}
141142
{{end}}
142143
</td>
143-
<td class="lines-num"></td>
144-
<td class="lines-escape"></td>
145-
<td class="lines-type-marker"></td>
146144
<td class="add-comment-right" colspan="4">
147145
{{if eq $line.GetCommentSide "proposed"}}
148146
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}

templates/repo/diff/section_unified.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{{$file := .file}}
2+
<colgroup>
3+
<col width="50">
4+
<col width="50">
5+
<col width="10">
6+
<col width="10">
7+
<col>
8+
</colgroup>
29
{{range $j, $section := $file.Sections}}
310
{{range $k, $line := $section.Lines}}
411
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}">
@@ -49,7 +56,6 @@
4956
</tr>
5057
{{if gt (len $line.Comments) 0}}
5158
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
52-
<td colspan="3" class="lines-num"></td>
5359
<td class="add-comment-left add-comment-right" colspan="5">
5460
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
5561
</td>

templates/repo/settings/lfs_file.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<td><strong>{{.locale.Tr "repo.file_too_large"}}</strong></td>
4949
{{else}}
5050
<td class="lines-num">{{.LineNums}}</td>
51-
<td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
51+
<td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol>{{.FileContent}}</ol></code></pre></td>
5252
{{end}}
5353
</tr>
5454
</tbody>

web_src/css/repository.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,8 +1806,14 @@
18061806
padding: 0 !important;
18071807
}
18081808

1809-
.repository .diff-file-box .code-diff tbody tr td.halfwidth {
1810-
width: 49%; /* halfwidth is used in split view - and in that case, 1% of each */
1809+
.repository .diff-file-box .code-diff table {
1810+
table-layout: fixed;
1811+
}
1812+
1813+
.repository .diff-file-box .code-diff tbody tr td.lines-num,
1814+
.repository .diff-file-box .code-diff tbody tr td.lines-escape,
1815+
.repository .diff-file-box .code-diff tbody tr td.lines-type-marker {
1816+
white-space: nowrap;
18111817
}
18121818

18131819
.repository .diff-file-box .code-diff tbody tr td.center {

web_src/css/review.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@
5353
margin-bottom: 0.5em;
5454
}
5555

56-
.add-comment .lines-num,
57-
.add-comment .lines-escape,
58-
.add-comment .lines-type-marker {
59-
display: none;
60-
}
61-
6256
.show-outdated:hover,
6357
.hide-outdated:hover {
6458
text-decoration: underline;

web_src/js/features/repo-issue.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,9 @@ export function initRepoPullRequestReview() {
546546
ntr = $(`
547547
<tr class="add-comment" data-line-type="${lineType}">
548548
${isSplit ? `
549-
<td class="lines-num"></td>
550-
<td class="lines-escape"></td>
551-
<td class="lines-type-marker"></td>
552549
<td class="add-comment-left" colspan="4"></td>
553-
<td class="lines-num"></td>
554-
<td class="lines-escape"></td>
555-
<td class="lines-type-marker"></td>
556550
<td class="add-comment-right" colspan="4"></td>
557551
` : `
558-
<td class="lines-num"></td>
559-
<td class="lines-num"></td>
560-
<td class="lines-escape"></td>
561552
<td class="add-comment-left add-comment-right" colspan="5"></td>
562553
`}
563554
</tr>`);

0 commit comments

Comments
 (0)