Files
gitea/templates/admin/packages/list.tmpl
T
silverwindandwxiaoguang e645afbb3f refactor: replace Fomantic modal with native dialog (#39846)
Replace Fomantic's hard-forked jQuery modal with native `<dialog>`
elements, advancing https://github.com/go-gitea/gitea/issues/29849. The
UI is visually unchanged. Dialogs open with `show()` over an `inert`
page, so tooltips, popups and toasts mounted on `<body>` stay usable
above them, unlike with `showModal()`
(https://github.com/whatwg/html/issues/9936).

- Remove the Fomantic modal and dimmer, add `showModal` and `hideModal`
- Declare modals as `<dialog class="modal-dialog">`, shown inside a
`.modal-backdrop`, instead of `ui modal` with its unused size classes
- Remove two modals that could never be opened
- Block the page while a modal is open, close the topmost one on Escape
and restore focus to its opener
- Allow stacked modals, use a confirm modal instead of `window.confirm`
for deleting content history
- Hide popups and toasts when a modal opens or closes
- Keep the release notes modal open when generating notes fails

Fixes: https://github.com/go-gitea/gitea/issues/39643
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-10-20 12:32:27 +02:00

97 lines
4.0 KiB
Handlebars

{{template "admin/layout_head" (dict "pageClass" "admin user")}}
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "admin.packages.package_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .TotalCount}},
{{ctx.Locale.Tr "admin.packages.total_size" (FormatByteSize .TotalBlobSize)}},
{{ctx.Locale.Tr "admin.packages.unreferenced_size" (FormatByteSize .TotalUnreferencedBlobSize)}})
<div class="ui right">
<form method="post" action="{{AppSubUrl}}/-/admin/packages/cleanup">
<button type="submit" class="ui primary tiny button">{{ctx.Locale.Tr "admin.packages.cleanup"}}</button>
</form>
</div>
</h4>
<div class="ui attached segment">
<form class="ui form ignore-dirty">
<div class="ui small fluid action input">
{{template "shared/search/input" dict "Value" .Query}}
<select class="ui small dropdown" name="type">
<option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option>
<option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option>
{{range $type := .AvailableTypes}}
<option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option>
{{end}}
</select>
{{template "shared/search/button"}}
</div>
</form>
</div>
<div class="ui attached table segment">
<table class="ui very basic table unstackable">
<thead>
<tr>
<th>ID</th>
<th>{{ctx.Locale.Tr "admin.packages.owner"}}</th>
<th>{{ctx.Locale.Tr "admin.packages.type"}}</th>
<th data-sortt-asc="name_asc" data-sortt-desc="name_desc">
{{ctx.Locale.Tr "admin.packages.name"}}
{{SortArrow "name_asc" "name_desc" .SortType false}}
</th>
<th data-sortt-asc="version_desc" data-sortt-desc="version_asc">
{{ctx.Locale.Tr "admin.packages.version"}}
{{SortArrow "version_desc" "version_asc" .SortType false}}
</th>
<th>{{ctx.Locale.Tr "admin.packages.creator"}}</th>
<th>{{ctx.Locale.Tr "admin.packages.repository"}}</th>
<th>{{ctx.Locale.Tr "admin.packages.size"}}</th>
<th data-sortt-asc="created_asc" data-sortt-desc="created_desc">
{{ctx.Locale.Tr "admin.packages.published"}}
{{SortArrow "created_asc" "created_desc" .SortType true}}
</th>
<th>{{ctx.Locale.Tr "admin.notices.op"}}</th>
</tr>
</thead>
<tbody>
{{range $pd := .PackageDescriptors}}
<tr>
<td>{{.Version.ID}}</td>
<td>{{template "admin/shared/owner" dict "OwnerUser" $pd.Owner}}</td>
<td>{{.Package.Type.Name}}</td>
<td class="gt-ellipsis tw-max-w-48">{{.Package.Name}}</td>
<td class="gt-ellipsis tw-max-w-48"><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td>
<td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td>
<td>
{{if .Repository}}
<a href="{{.Repository.Link}}">{{.Repository.Name}}</a>
{{end}}
</td>
<td>{{FormatByteSize .CalculateBlobSize}}</td>
<td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
<td>
<a class="tw-text-red show-modal" href data-modal="#admin-package-delete-modal"
data-modal-form.url="{{$.Link}}/delete?id={{$pd.Version.ID}}"
data-modal-package-name="{{$pd.Package.Name}}" data-modal-package-version="{{$pd.Version.Version}}"
>{{svg "octicon-trash"}}</a>
</td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="10">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
</div>
{{template "base/paginate" .}}
</div>
<dialog class="modal-dialog" id="admin-package-delete-modal">
<div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "packages.settings.delete.version"}}</div>
<form class="form-fetch-action" method="post">
<div class="content">
{{ctx.Locale.Tr "packages.settings.delete.notice" (HTMLFormat `<span class="%s"></span>` "package-name") (HTMLFormat `<span class="%s"></span>` "package-version")}}
</div>
{{template "base/modal_actions_confirm" .}}
</form>
</dialog>
{{template "admin/layout_footer" .}}