Files
gitea/templates/org/team/members.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

87 lines
3.6 KiB
Handlebars

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content organization teams">
{{template "org/header" .}}
<div class="ui container">
{{template "base/alert" .}}
<div class="ui stackable grid">
{{template "org/team/sidebar" .}}
<div class="ui ten wide column">
{{template "org/team/navbar" .}}
{{if .IsOrganizationOwner}}
<div class="ui top attached segment">
<form class="ui form ignore-dirty tw-flex tw-flex-wrap tw-gap-2" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/add" method="post">
<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
<div id="search-user-box" class="ui search tw-mr-2"{{if .IsEmailInviteEnabled}} data-allow-email="true" data-allow-email-description="{{ctx.Locale.Tr "org.teams.invite_team_member" $.Team.Name}}"{{end}}>
<div class="ui input">
<input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required>
</div>
</div>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "org.teams.add_team_member"}}</button>
</form>
</div>
{{end}}
<div class="ui{{if not .IsOrganizationOwner}} top{{end}} attached segment">
<div class="flex-divided-list items-with-main">
{{range .Team.Members}}
<div class="item tw-items-center">
<div class="item-leading">
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a>
</div>
<div class="item-main">
<div class="item-title">
{{template "shared/user/name" .}}
</div>
</div>
<div class="item-trailing">
{{if and $.IsOrganizationOwner (not (and ($.Team.IsOwnerTeam) (eq (len $.Team.Members) 1)))}}
<button type="button" class="ui red button show-modal" data-modal="#remove-team-member"
data-modal-form.url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove?uid={{.ID}}"
data-modal-name="{{.DisplayName}}"
data-modal-team-name="{{$.Team.Name}}">{{ctx.Locale.Tr "org.members.remove"}}</button>
{{end}}
</div>
</div>
{{else}}
<div class="item">
<span class="tw-text-text-light tw-italic">{{ctx.Locale.Tr "org.teams.members.none"}}</span>
</div>
{{end}}
</div>
</div>
{{if and .Invites $.IsOrganizationOwner}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "org.teams.invite_team_member.list"}}</h4>
<div class="ui attached segment">
<div class="flex-divided-list items-with-main">
{{range .Invites}}
<div class="item tw-items-center">
<div class="item-main">
{{.Email}}
</div>
<div class="item-trailing">
<form action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove_invite" method="post">
<input type="hidden" name="iid" value="{{.ID}}">
<button type="submit" class="ui red button">{{ctx.Locale.Tr "org.members.remove"}}</button>
</form>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
</div>
</div>
</div>
</div>
<dialog class="modal-dialog" id="remove-team-member">
<div class="header">
{{ctx.Locale.Tr "org.members.remove"}}
</div>
<form class="form-fetch-action" method="post">
<div class="content">
<p>{{ctx.Locale.Tr "org.members.remove.detail" (HTMLFormat `<span class="%s"></span>` "name") (HTMLFormat `<span class="%s"></span>` "team-name")}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</form>
</dialog>
{{template "base/footer" .}}