Files
gitea/templates/admin/badge/edit.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

45 lines
1.6 KiB
Handlebars

{{template "admin/layout_head" (dict "pageClass" "admin edit badge")}}
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "admin.badges.edit_badge"}}
</h4>
<div class="ui attached segment">
<form class="ui form form-fetch-action" action="./edit" method="post">
<div class="field">
<label>{{ctx.Locale.Tr "admin.badges.slug"}}</label>
<input value="{{.Badge.Slug}}" readonly>
</div>
<div class="field {{if .Err_Description}}error{{end}}">
<label>{{ctx.Locale.Tr "admin.badges.description"}}</label>
<textarea name="description" rows="2">{{.Badge.Description}}</textarea>
</div>
<div class="field {{if .Err_ImageURL}}error{{end}}">
<label>{{ctx.Locale.Tr "admin.badges.image_url"}}</label>
<input type="url" name="image_url" value="{{.Badge.ImageURL}}">
</div>
<div class="divider"></div>
<div class="field">
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "admin.badges.update_badge"}}</button>
<button type="button" class="ui red button show-modal" data-modal="#delete-badge-modal">{{ctx.Locale.Tr "admin.badges.delete_badge"}}</button>
</div>
</form>
</div>
</div>
<dialog class="modal-dialog" id="delete-badge-modal">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "admin.badges.delete_badge"}}
</div>
<form class="ui form" method="post" action="./delete">
<div class="content">
<p>{{ctx.Locale.Tr "admin.badges.delete_badge_desc"}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</form>
</dialog>
{{template "admin/layout_footer" .}}