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

76 lines
3.7 KiB
Handlebars

{{template "repo/settings/layout_head" (dict "pageClass" "repository settings")}}
<div class="repo-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.deploy_keys"}}
<div class="ui right">
{{if not .DisableSSH}}
<button type="button" class="ui primary compact tiny button show-panel toggle" data-panel="#add-deploy-key-ssh-panel" data-panel-hide="#add-deploy-key-token-panel">{{ctx.Locale.Tr "repo.settings.add_deploy_key_ssh"}}</button>
{{else}}
<button type="button" class="ui primary compact tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button>
{{end}}
<button type="button" class="ui primary compact tiny button show-panel toggle" data-panel="#add-deploy-key-token-panel" data-panel-hide="#add-deploy-key-ssh-panel">{{ctx.Locale.Tr "repo.settings.generate_deploy_token"}}</button>
</div>
</h4>
<div class="ui attached segment">
<div class="tw-hidden tw-mb-4" id="add-deploy-key-ssh-panel">
<form class="ui form form-fetch-action" action="{{.Link}}" method="post">
<div class="field">{{ctx.Locale.Tr "repo.settings.deploy_key_ssh_desc"}}</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.title"}}</label>
<input name="title" autofocus required>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "settings.key_content"}}</label>
<textarea name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required></textarea>
</div>
<div class="field">
<div class="ui checkbox">
<input name="is_writable" type="checkbox" value="1">
<label>{{ctx.Locale.Tr "repo.settings.is_writable"}}</label>
<small class="tw-pl-[20px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small>
</div>
</div>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_deploy_key_ssh"}}</button>
<button type="button" class="ui hide-panel button" data-panel="#add-deploy-key-ssh-panel">{{ctx.Locale.Tr "cancel"}}</button>
</form>
<div class="divider"></div>
</div>
<div class="tw-hidden tw-mb-4" id="add-deploy-key-token-panel">
<form class="ui form form-fetch-action" action="{{.Link}}/generate-token" method="post">
<div class="field">{{ctx.Locale.Tr "repo.settings.deploy_key_token_desc"}}</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.title"}}</label>
<input name="title" autofocus required>
</div>
<div class="field">
<div class="ui checkbox">
<input name="is_writable" type="checkbox" value="1">
<label>{{ctx.Locale.Tr "repo.settings.is_writable"}}</label>
<small class="tw-pl-[20px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small>
</div>
</div>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.settings.generate_deploy_token"}}</button>
<button type="button" class="ui hide-panel button" data-panel="#add-deploy-key-token-panel">{{ctx.Locale.Tr "cancel"}}</button>
</form>
<div class="divider"></div>
</div>
{{template "repo/settings/deploy_key_list" dict "RepoDeployKeys" .RepoDeployKeys}}
</div>
</div>
<dialog class="modal-dialog" id="repo-deploy-key-delete-modal">
<div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "remove"}}</div>
<div class="content"><p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p></div>
{{template "base/modal_actions_confirm" .}}
</dialog>
<dialog class="modal-dialog" id="repo-deploy-token-regenerate-modal">
<div class="header">{{svg "octicon-sync"}} {{ctx.Locale.Tr "settings.regenerate_token"}}</div>
<div class="content"><p>{{ctx.Locale.Tr "repo.settings.regenerate_deploy_token_desc"}}</p></div>
{{template "base/modal_actions_confirm" .}}
</dialog>
{{template "repo/settings/layout_footer" .}}