Files
gitea/templates/package/settings.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

88 lines
3.7 KiB
Handlebars

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content package settings options{{if .ContextUser.IsOrganization}} organization{{end}}">
{{if .ContextUser.IsOrganization}}
{{template "org/header" .}}
{{else}}
{{template "shared/user/org_profile_avatar" .}}
{{end}}
<div class="ui container">
{{if not .ContextUser.IsOrganization}}
{{template "user/overview/header" .}}
{{end}}
{{template "base/alert" .}}
<p>
<a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a>
<span class="label-list">
{{template "package/shared/visibility_badge" dict "Package" .PackageDescriptor.Package "Owner" .PackageDescriptor.Owner}}
</span>
/ <strong>{{ctx.Locale.Tr "repo.settings"}}</strong>
</p>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "packages.settings.visibility"}}
</h4>
<div class="ui attached segment">
<p>{{ctx.Locale.Tr "packages.settings.visibility.inherit"}}</p>
<a class="ui basic button" href="{{.ContextUser.SettingsLink}}">{{ctx.Locale.Tr "packages.settings.visibility.button"}}</a>
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "packages.settings.link"}}
</h4>
<div class="ui attached segment">
<p>{{ctx.Locale.Tr "packages.settings.link.description"}}</p>
<p>- {{ctx.Locale.Tr "packages.settings.link.notice1"}}</p>
<p>- {{ctx.Locale.Tr "packages.settings.link.notice2"}}</p>
<p>- {{ctx.Locale.Tr "packages.settings.link.notice3"}}</p>
<form class="ui form form-fetch-action ignore-dirty flex-text-block" action="{{.Link}}" method="post">
<input type="hidden" name="action" value="link">
<div data-global-init="initSearchRepoBox" class="ui search" data-uid="{{.PackageDescriptor.Owner.ID}}">
<div class="ui input">
<input class="prompt" name="repo_name" value="{{.LinkedRepoName}}" placeholder="{{ctx.Locale.Tr "search.repo_kind"}}" autocomplete="off">
</div>
</div>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "packages.settings.link.button"}}</button>
</form>
</div>
<h4 class="ui top attached error header">
{{ctx.Locale.Tr "repo.settings.danger_zone"}}
</h4>
<div class="ui attached error danger segment">
<div class="flex-divided-list items-with-main">
<div class="item">
<div class="item-main">
<div class="item-title">{{ctx.Locale.Tr "packages.settings.delete"}}</div>
<div class="item-body">{{ctx.Locale.Tr "packages.settings.delete.description"}}</div>
</div>
<div class="item-trailing">
<button type="button" class="ui basic red show-modal button" data-modal="#delete-package-modal">{{ctx.Locale.Tr "packages.settings.delete"}}</button>
</div>
<dialog class="modal-dialog" id="delete-package-modal">
<div class="header">
{{ctx.Locale.Tr "packages.settings.delete"}}
</div>
<div class="content">
<div class="ui warning message tw-break-anywhere">
{{ctx.Locale.Tr "packages.settings.delete.notice.package" .PackageDescriptor.Package.Name}}
</div>
<form class="ui form" action="{{.Link}}" method="post">
<input type="hidden" name="action" value="delete">
<div class="field">
<label>
{{ctx.Locale.Tr "packages.settings.delete.confirm"}}
<span class="tw-text-red">{{.PackageDescriptor.Package.Name}}</span>
</label>
</div>
<div class="required field">
<label>{{ctx.Locale.Tr "packages.name"}}</label>
<input name="package_name" required maxlength="100">
</div>
{{template "base/modal_actions_confirm" .}}
</form>
</div>
</dialog>
</div>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}