githaven-fork/templates/repo/settings/lfs_pointers.tmpl
Kerwin Bryant e6ab6e637f
code optimization (#31315)
Simplifying complex if-else to existing Iif operations
2024-06-11 21:07:10 +08:00

57 lines
2.4 KiB
Handlebars

{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}}
<div class="repo-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist}}
{{if gt .NumAssociatable 0}}
<div class="ui right">
<form class="ui form" method="post" action="{{$.Link}}/associate">
{{.CsrfTokenHtml}}
{{range .Pointers}}
{{if .Associatable}}
<input type="hidden" name="oid" value="{{.Oid}} {{.Size}}">
{{end}}
{{end}}
<button class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.lfs_pointers.associateAccessible" $.NumAssociatable}}</button>
</form>
</div>
{{end}}
</h4>
<div class="ui attached segment">
<table id="lfs-files-table" class="ui fixed single line table">
<thead>
<tr>
<th class="three wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.sha"}}</th>
<th class="four wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.oid"}}</th>
<th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.inRepo"}}</th>
<th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.exists"}}</th>
<th class="two wide" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}">{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}</th>
<th class="three wide"></th>
</tr>
</thead>
<tbody>
{{range .Pointers}}
<tr>
<td>
<a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" title="{{.SHA}}" class="ui button tw-font-mono">
{{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">
{{ShortSha .Oid}}
</a>
</td>
<td>{{svg (Iif .InRepo "octicon-check" "octicon-x")}}</td>
<td>{{svg (Iif .Exists "octicon-check" "octicon-x")}}</td>
<td>{{svg (Iif .Accessible "octicon-check" "octicon-x")}}</td>
<td class="tw-text-right">
<a class="ui primary button" href="{{$.LFSFilesLink}}/find?oid={{.Oid}}&size={{.Size}}&sha={{.SHA}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{template "repo/settings/layout_footer" .}}