chore: fix various problems (#39298)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
wxiaoguang
2026-09-14 22:15:21 +02:00
committed by GitHub
co-authored by Lunny Xiao
parent 85cbf477e5
commit c0ceea2f8f
14 changed files with 124 additions and 122 deletions
+19 -23
View File
@@ -3,8 +3,8 @@
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.lfs_filelist"}} ({{ctx.Locale.Tr "admin.total" .Total}})
<div class="ui right">
<a class="ui tiny button" href="{{.Link}}/locks">{{ctx.Locale.Tr "repo.settings.lfs_locks"}}</a>
<a class="ui primary tiny button" href="{{.Link}}/pointers">&nbsp;{{ctx.Locale.Tr "repo.settings.lfs_findpointerfiles"}}</a>
<a class="ui tiny compact button" href="{{.Link}}/locks">{{ctx.Locale.Tr "repo.settings.lfs_locks"}}</a>
<a class="ui primary tiny compact button" href="{{.Link}}/pointers">&nbsp;{{ctx.Locale.Tr "repo.settings.lfs_findpointerfiles"}}</a>
</div>
</h4>
<table id="lfs-files-table" class="ui attached segment single line table">
@@ -12,17 +12,21 @@
{{range .LFSFiles}}
<tr>
<td>
<a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui button tw-font-mono">
<a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui label commit-id-short">
{{ShortSha .Oid}}
</a>
</td>
<td>{{FormatByteSize .Size}}</td>
<td>{{DateUtils.TimeSince .CreatedUnix}}</td>
<td class="tw-text-right">
<a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
<button type="button" class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}">
<span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}">{{svg "octicon-trash"}}</span>
</button>
<td>
<div class="flex-text-block tw-justify-end">
<a class="ui basic primary tiny compact button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
<button type="button" class="ui basic tiny compact red icon button show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}"
data-modal="#delete-lfs-object" data-modal-header="{{ctx.Locale.Tr "repo.settings.lfs_delete" .Oid}}" data-modal-form.url="{{$.Link}}/delete/{{.Oid}}"
>
{{svg "octicon-trash" 14}}
</button>
</div>
</td>
</tr>
{{else}}
@@ -33,20 +37,12 @@
</tbody>
</table>
{{template "base/paginate" .}}
{{range .LFSFiles}}
<div class="ui g-modal-confirm modal" id="delete-{{.Oid}}">
<div class="header">
{{ctx.Locale.Tr "repo.settings.lfs_delete" .Oid}}
</div>
<div class="content">
<p>
{{ctx.Locale.Tr "repo.settings.lfs_delete_warning"}}
</p>
<form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post">
{{template "base/modal_actions_confirm"}}
</form>
</div>
</div>
{{end}}
<div class="ui g-modal-confirm modal" id="delete-lfs-object">
<div class="header"></div>
<form class="content" method="post">
<p>{{ctx.Locale.Tr "repo.settings.lfs_delete_warning"}}</p>
{{template "base/modal_actions_confirm"}}
</form>
</div>
</div>
{{template "repo/settings/layout_footer" .}}
+5 -12
View File
@@ -12,13 +12,15 @@
</div>
</h4>
<div class="ui bottom attached segment file-view-container">
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}}
<div class="file-view {{if .IsPlainText}}plain-text{{else if .IsTextFile}}code-view{{end}}">
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus}}
<div class="file-view">
{{if .IsFileTooLarge}}
{{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}}
{{else if not .FileSize}}
{{template "shared/fileisempty"}}
{{else if not .IsTextFile}}
{{else if .FileContentHTML}}
{{.FileContentHTML}}
{{else}}
<div class="view-raw">
{{if .IsImageFile}}
<img loading="lazy" alt="{{$.RawFileLink}}" src="{{$.RawFileLink}}">
@@ -34,15 +36,6 @@
<a href="{{$.RawFileLink}}" rel="nofollow" class="tw-p-4">{{ctx.Locale.Tr "repo.file_view_raw"}}</a>
{{end}}
</div>
{{else if .FileSize}}
<table>
<tbody>
<tr>
<td class="lines-num">{{.LineNums}}</td>
<td class="lines-code"><pre>{{.FileContent}}</pre></td>
</tr>
</tbody>
</table>
{{end}}
</div>
</div>
+3 -2
View File
@@ -31,12 +31,13 @@
{{range .Pointers}}
<tr>
<td>
<a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" title="{{.SHA}}" class="ui button tw-font-mono">
<a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" title="{{.SHA}}" class="ui label commit-id-short">
{{ShortSha .SHA}}
</a>
</td>
<td>
<a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui button tw-font-mono">
{{$lfsObjectViewable := and .Exists .InRepo}}
<a href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank" title="{{.Oid}}" class="ui label commit-id-short {{if not $lfsObjectViewable}}disabled{{end}}">
{{ShortSha .Oid}}
</a>
</td>