Skip to content

Commit d1527da

Browse files
authored
Improve file history UI and fix URL escaping bug (#27531)
Follow #27354 Major changes: 1. The `right aligned` in `<th class="one wide right aligned">` is a no-op because it doesn't have any content 2. The `gt-df` in `<td class="sha gt-df">` was wrong, it causes UI misalignment, a table cell shouldn't be "flex" 3. Use `gt-py-0` for `gt-pt-0 gt-pb-0` 4. Simplify the layout for buttons, because the `text right aligned` is widely used and good enough, it doesn't make sense to introduce the `<div class="gt-df gt-je">` 5. Escape the `$.FileName` correctly Before: ![image](https://github.com/go-gitea/gitea/assets/2114189/eb2ced3f-1dad-4149-9ed2-aee4c0663621) After: ![image](https://github.com/go-gitea/gitea/assets/2114189/08244b61-416b-4279-b495-029bc0a96f67)
1 parent 43632d9 commit d1527da

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

templates/repo/commits_list.tmpl

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<th class="two wide sha">SHA1</th>
77
<th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
88
<th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th>
9-
<th class="one wide right aligned"></th>
9+
<th class="one wide"></th>
1010
</tr>
1111
</thead>
1212
<tbody class="commit-list">
@@ -25,7 +25,7 @@
2525
{{$userName}}
2626
{{end}}
2727
</td>
28-
<td class="sha gt-df">
28+
<td class="sha">
2929
{{$class := "ui sha label"}}
3030
{{if .Signature}}
3131
{{$class = (print $class " isSigned")}}
@@ -76,11 +76,11 @@
7676
{{else}}
7777
<td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</td>
7878
{{end}}
79-
<td class="gt-pt-0 gt-pb-0">
80-
<div class="gt-df gt-je">
81-
<button class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
82-
{{if $.FileName}}<a class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{printf "%s/src/commit/%s/%s" $commitRepoLink (PathEscape .ID.String) $.FileName}}">{{svg "octicon-file-code"}}</a>{{end}}
83-
</div>
79+
<td class="text right aligned gt-py-0">
80+
<button class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
81+
{{if $.FileName}}
82+
<a class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{printf "%s/src/commit/%s/%s" $commitRepoLink (PathEscape .ID.String) (PathEscapeSegments $.FileName)}}">{{svg "octicon-file-code"}}</a>
83+
{{end}}
8484
</td>
8585
</tr>
8686
{{end}}

0 commit comments

Comments
 (0)