Files
gitea/templates/admin/user/view_orgs.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

56 lines
2.0 KiB
Handlebars

{{$user := .User}}
{{$userOrgs := .UserOrgs}}
{{$userOrgsTotal := (len $userOrgs)}}
<h4 class="ui top attached header flex-left-right">
<span>{{ctx.Locale.Tr "settings.organization"}} ({{ctx.Locale.Tr "admin.total" $userOrgsTotal}})</span>
{{if $userOrgs}}
<button type="button" class="ui red tiny button show-modal" data-modal="#remove-all-orgs-modal">{{ctx.Locale.Tr "remove_all"}}</button>
<dialog class="modal-dialog" id="remove-all-orgs-modal">
<div class="header">
{{ctx.Locale.Tr "admin.users.remove_all_orgs_title"}}
</div>
<form class="form-fetch-action" method="post" action="{{ctx.RootData.Link}}/orgs/remove-all">
<div class="content">
<p>{{ctx.Locale.Tr "admin.users.remove_all_orgs_desc" $user.Name $userOrgsTotal}}</p>
</div>
<div class="actions">
<div class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</div>
<button class="ui red button" type="submit">{{ctx.Locale.Tr "remove_all"}}</button>
</div>
</form>
</dialog>
{{end}}
</h4>
{{if $userOrgs}}
<div class="ui attached segment">
<div class="flex-divided-list items-with-main">
{{range $org := $userOrgs}}
<div class="item tw-items-center">
<div class="item-leading">
{{ctx.AvatarUtils.Avatar $org 48}}
</div>
<div class="item-main">
<div class="item-title">
{{template "shared/user/name" $org.AsUser}}
{{if $org.Visibility.IsPrivate}}
<span class="ui basic tiny label">{{ctx.Locale.Tr "repo.desc.private"}}</span>
{{end}}
</div>
<div class="item-body">
<span class="flex-text-inline">
{{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort $org.CreatedUnix)}}
</span>
</div>
</div>
<div class="item-trailing">
<button class="ui red tiny button link-action" type="button" data-url="{{ctx.RootData.Link}}/orgs/{{$org.ID}}/remove"
data-modal-confirm="{{ctx.Locale.Tr "confirm_remove"}}"
>{{ctx.Locale.Tr "remove"}}</button>
</div>
</div>
{{end}}
</div>
</div>
{{end}}