mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
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>
69 lines
2.8 KiB
Handlebars
69 lines
2.8 KiB
Handlebars
{{if .AllowPrincipals}}
|
|
<h4 class="ui top attached header">
|
|
{{ctx.Locale.Tr "settings.manage_ssh_principals"}}
|
|
<div class="ui right">
|
|
{{if not .DisableSSH}}
|
|
<button type="button" class="ui primary tiny show-panel button" data-panel="#add-ssh-principal-panel">{{ctx.Locale.Tr "settings.add_new_principal"}}</button>
|
|
{{else}}
|
|
<button type="button" class="ui primary tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button>
|
|
{{end}}
|
|
</div>
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<div class="flex-divided-list items-with-main">
|
|
<div class="item">
|
|
{{ctx.Locale.Tr "settings.principal_desc"}}
|
|
</div>
|
|
{{range .Principals}}
|
|
<div class="item">
|
|
<div class="item-leading">
|
|
<span class="{{if .HasRecentActivity}}tw-text-green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.principal_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span>
|
|
</div>
|
|
<div class="item-main">
|
|
<div class="item-title">{{.Name}}</div>
|
|
<div class="item-body">
|
|
<i>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
|
|
</div>
|
|
</div>
|
|
<div class="item-trailing">
|
|
<button type="button" class="ui red tiny button link-action" data-modal-confirm="#delete-principal" data-url="{{$.Link}}/delete?type=principal&id={{.ID}}">
|
|
{{ctx.Locale.Tr "remove"}}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<br>
|
|
|
|
<div {{if not .HasPrincipalError}}class="tw-hidden"{{end}} id="add-ssh-principal-panel">
|
|
<h4 class="ui top attached header">
|
|
{{ctx.Locale.Tr "settings.add_new_principal"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<form class="ui form" action="{{.Link}}" method="post">
|
|
<div class="field {{if .Err_Content}}error{{end}}">
|
|
<label for="ssh-principal-content">{{ctx.Locale.Tr "settings.principal_content"}}</label>
|
|
<input id="ssh-principal-content" name="content" value="{{.content}}" autofocus required>
|
|
</div>
|
|
<input name="title" type="hidden" value="principal">
|
|
<input name="type" type="hidden" value="principal">
|
|
<button type="submit" class="ui primary button">
|
|
{{ctx.Locale.Tr "settings.add_new_principal"}}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<dialog class="modal-dialog" id="delete-principal">
|
|
<div class="header">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "settings.ssh_principal_deletion"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{ctx.Locale.Tr "settings.ssh_principal_deletion_desc"}}</p>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" .}}
|
|
</dialog>
|
|
{{end}}
|