Skip to content

Commit ecdfde1

Browse files
committed
Use vertical layout for multiple code expander buttons
Fixes: go-gitea#31068
1 parent aa92b13 commit ecdfde1

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded">
44
{{if eq .GetType 4}}
55
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}">
6-
<div class="tw-flex">
6+
<div class="code-expander-buttons">
77
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
88
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
99
{{svg "octicon-fold-down"}}
@@ -49,7 +49,7 @@
4949
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded">
5050
{{if eq .GetType 4}}
5151
<td colspan="2" class="lines-num">
52-
<div class="tw-flex">
52+
<div class="code-expander-buttons">
5353
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
5454
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?data-query={{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
5555
{{svg "octicon-fold-down"}}

templates/repo/diff/section_split.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}">
1818
{{if eq .GetType 4}}
1919
<td class="lines-num lines-num-old">
20-
<div class="tw-flex">
20+
<div class="code-expander-buttons">
2121
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
2222
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
2323
{{svg "octicon-fold-down"}}

templates/repo/diff/section_unified.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{if eq .GetType 4}}
1414
{{if $.root.AfterCommitID}}
1515
<td colspan="2" class="lines-num">
16-
<div class="tw-flex">
16+
<div class="code-expander-buttons">
1717
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
1818
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
1919
{{svg "octicon-fold-down"}}

web_src/css/review.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
.code-expander-button {
203203
border: none;
204204
color: var(--color-text-light);
205-
height: 28px;
205+
height: 18px;
206206
display: flex;
207207
justify-content: center;
208208
align-items: center;
@@ -211,6 +211,10 @@
211211
flex: 1;
212212
}
213213

214+
.code-expander-button:only-child {
215+
height: 28px;
216+
}
217+
214218
.code-expander-button:hover {
215219
background: var(--color-primary);
216220
color: var(--color-primary-contrast);

0 commit comments

Comments
 (0)