Files
gitea/templates/repo/issue/sidebar/issue_management.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

108 lines
3.5 KiB
Handlebars

{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
<div class="divider"></div>
{{/* Pin issue */}}
{{if or .PinEnabled .Issue.IsPinned}}
<form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}>
<button type="submit" class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}">
{{if not .Issue.IsPinned}}
{{svg "octicon-pin"}}
{{ctx.Locale.Tr "pin"}}
{{else}}
{{svg "octicon-pin-slash"}}
{{ctx.Locale.Tr "unpin"}}
{{end}}
</button>
</form>
{{end}}
{{/* Lock/unlock conversation */}}
<button type="button" class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation">
{{if .Issue.IsLocked}}
{{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}}
{{else}}
{{svg "octicon-lock"}} {{ctx.Locale.Tr "repo.issues.lock"}}
{{end}}
</button>
<dialog class="modal-dialog" id="lock-conversation">
<div class="header">
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock.title"}}
{{else}}
{{ctx.Locale.Tr "repo.issues.lock.title"}}
{{end}}
</div>
<div class="content">
<div class="ui warning message">
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock.notice_1"}}<br>
{{ctx.Locale.Tr "repo.issues.unlock.notice_2"}}<br>
{{else}}
{{ctx.Locale.Tr "repo.issues.lock.notice_1"}}<br>
{{ctx.Locale.Tr "repo.issues.lock.notice_2"}}<br>
{{ctx.Locale.Tr "repo.issues.lock.notice_3"}}<br>
{{end}}
</div>
<form class="ui form form-fetch-action" method="post" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}">
{{if not .Issue.IsLocked}}
<div class="field">
<strong>{{ctx.Locale.Tr "repo.issues.lock.reason"}}</strong>
</div>
<div class="field">
<div class="ui fluid dropdown selection">
<input type="hidden" name="reason">
<div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item" data-value=""></div>
{{range .LockReasons}}
<div class="item" data-value="{{.}}">{{.}}</div>
{{end}}
</div>
</div>
</div>
{{end}}
<div class="actions">
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
{{/* explicitly focus the submit button, otherwise the modal focuses and pops up the dropdown */}}
<button type="submit" class="ui red button" autofocus>
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock_confirm"}}
{{else}}
{{ctx.Locale.Tr "repo.issues.lock_confirm"}}
{{end}}
</button>
</div>
</form>
</div>
</dialog>
<button type="button" class="tw-mt-1 fluid ui show-modal button" data-modal="#sidebar-delete-issue">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.delete"}}
</button>
<dialog class="modal-dialog" id="sidebar-delete-issue">
<div class="header">
{{if .Issue.IsPull}}
{{ctx.Locale.Tr "repo.pulls.delete.title"}}
{{else}}
{{ctx.Locale.Tr "repo.issues.delete.title"}}
{{end}}
</div>
<div class="content">
<p>
{{if .Issue.IsPull}}
{{ctx.Locale.Tr "repo.pulls.delete.text"}}
{{else}}
{{ctx.Locale.Tr "repo.issues.delete.text"}}
{{end}}
</p>
</div>
<form action="{{.Issue.Link}}/delete" method="post">
{{template "base/modal_actions_confirm" .}}
</form>
</dialog>
{{end}}