forgejo/templates/org/settings/delete.tmpl
Gusted 72bac98365 feat: require data-modal-id for delete buttons (#8711)
All instances should have a `data-modal-id` now. Throw a user-friendly error if this is not the case (custom templates, or missed cases).

Checked via `rg -P -e '^(?=.*delete-button)' | grep -v "data-modal-id"`

Removed two instances of delete modals and one case of simplified logic.

## Rationale
I am currently surveying the existing modals in Forgejo in the context of eventually replacing the modals implementation with our own modal implementation. This refactor fixes one of the many inconsistencies that the current usage of modals has. It should explicitly specify which modal should be used to avoids any problems if new modals are introduced on the page (for example via https://codeberg.org/forgejo/forgejo/pulls/8662).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8711
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-08-08 01:53:23 +02:00

35 lines
1.4 KiB
Go HTML Template

{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings delete")}}
<div class="org-setting-content">
<h4 class="ui top attached error header">
{{ctx.Locale.Tr "org.settings.delete_account"}}
</h4>
<div class="ui attached error segment">
<div class="ui red message">
<p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt"}}</p>
</div>
<form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="inline required field {{if .Err_OrgName}}error{{end}}">
<label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}}</label>
<input id="org_name" name="org_name" value="" autocomplete="off" autofocus required>
</div>
<button class="ui red button delete-button" data-type="form" data-form="#delete-form" data-modal-id="delete-org">
{{ctx.Locale.Tr "org.settings.confirm_delete_account"}}
</button>
</form>
</div>
</div>
<div class="ui g-modal-confirm delete modal" id="delete-org">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "org.settings.delete_org_title"}}
</div>
<div class="content">
<p>{{ctx.Locale.Tr "org.settings.delete_org_desc"}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</div>
{{template "org/settings/layout_footer" .}}