diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-10-09 15:19:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 07:19:23 +0000 |
commit | d1527dac3d1e68caf5a6f54c08144e28256e5c47 (patch) | |
tree | 0d4281fbfdebf326b1eced9587acfc1b4b7ca816 /templates | |
parent | 43632d9d34dd8e7f28cac86cd619d5d0049e3d28 (diff) | |
download | gitea-d1527dac3d1e68caf5a6f54c08144e28256e5c47.tar.gz gitea-d1527dac3d1e68caf5a6f54c08144e28256e5c47.zip |
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:

After:

Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/commits_list.tmpl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 6793a81bff..d071fb90a1 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -6,7 +6,7 @@ <th class="two wide sha">SHA1</th> <th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th> <th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th> - <th class="one wide right aligned"></th> + <th class="one wide"></th> </tr> </thead> <tbody class="commit-list"> @@ -25,7 +25,7 @@ {{$userName}} {{end}} </td> - <td class="sha gt-df"> + <td class="sha"> {{$class := "ui sha label"}} {{if .Signature}} {{$class = (print $class " isSigned")}} @@ -76,11 +76,11 @@ {{else}} <td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</td> {{end}} - <td class="gt-pt-0 gt-pb-0"> - <div class="gt-df gt-je"> - <button class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> - {{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}} - </div> + <td class="text right aligned gt-py-0"> + <button class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> + {{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) (PathEscapeSegments $.FileName)}}">{{svg "octicon-file-code"}}</a> + {{end}} </td> </tr> {{end}} |