Files
gitea/templates/user/settings/security/accountlinks.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

63 lines
2.0 KiB
Handlebars

{{/* No account links, no way to add account links: Menu will not be shown. */}}
{{if or .AccountLinks .OrderedOAuth2Names}}
<h4 class="ui top attached header">
{{ctx.Locale.Tr "settings.manage_account_links"}}
{{if .OrderedOAuth2Names}}
<div class="ui right">
<div class="ui dropdown">
<div class="ui primary tiny button">{{ctx.Locale.Tr "settings.link_account"}}</div>
<div class="menu">
{{range $key := .OrderedOAuth2Names}}
{{$provider := index $.OAuth2Providers $key}}
<a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key | PathEscape}}">
{{$provider.IconHTML 20}}
{{$provider.DisplayName}}
</a>
{{end}}
</div>
</div>
</div>
{{end}}
</h4>
<div class="ui attached segment">
<div class="flex-divided-list items-with-main">
<div class="item">
{{ctx.Locale.Tr "settings.manage_account_links_desc"}}
</div>
{{range $loginSource, $provider := .AccountLinks}}
<div class="item">
{{$providerData := index $.OAuth2Providers $loginSource.Name}}
<div class="item-leading">
{{$providerData.IconHTML 20}}
</div>
<div class="item-main">
<span class="item-title" data-tooltip-content="{{$provider}}">
{{$loginSource.Name}}
</span>
{{if $loginSource.IsActive}}
<span class="flex-text-body tw-text-primary">{{ctx.Locale.Tr "repo.settings.active"}}</span>
{{end}}
</div>
<div class="item-trailing">
<button type="button" class="ui red tiny button link-action" data-modal-confirm="#delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link?id={{$loginSource.ID}}">
{{ctx.Locale.Tr "remove"}}
</button>
</div>
</div>
{{end}}
</div>
<dialog class="modal-dialog" id="delete-account-link">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "settings.remove_account_link"}}
</div>
<div class="content">
<p>{{ctx.Locale.Tr "settings.remove_account_link_desc"}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</dialog>
</div>
{{end}}