1
0
Fork 0
forked from forgejo/forgejo

Refactor delete_modal_actions template and use it for project column related actions (#24097)

Co-Author: @wxiaoguang 

This PR is to fix
https://github.com/go-gitea/gitea/issues/23318#issuecomment-1506275446 .
The way to fix this in this PR is to use `delete_modal_actions.tmpl`
here both to fix this issue and keep ui consistency (as suggested by
[TODO
here](4299c3b7db/templates/projects/view.tmpl (L161)))

And this PR also refactors `delete_modal_actions.tmpl` and its related
styles, and use the template for more modal actions:

1. Added template attributes:
* locale
* ModalButtonStyle: "yes" (default) or "confirm"
* ModalButtonCancelText
* ModalButtonOkText

2. Rename `delete_modal_actions.tmpl` template to
`modal_actions_confirm.tmpl` because it is not only used for action
modals deletion now.

3. Refactored css related to modals into `web_src/css/modules/modal.css`
and improved the styles.

4. Also use the template for PR deletion modal and remove issue
dependency modal.

5. Some modals should also use the template, but not sure how to open
them, so mark these modal actions by `{{/* TODO: Convert to
base/modal_actions_confirm */}}`

After (Also tested on arc green):

Hovering on the left buttons

<img width="711" alt="Screen Shot 2023-04-23 at 15 17 12"
src="https://user-images.githubusercontent.com/17645053/233825650-76307e65-9255-44bb-80e8-7062f58ead1b.png">

<img width="786" alt="Screen Shot 2023-04-23 at 15 17 21"
src="https://user-images.githubusercontent.com/17645053/233825652-4dc6f7d1-a180-49fb-a468-d60950eaee0d.png">

Test for functionalities:

https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Hester Gong 2023-04-23 17:24:19 +08:00 committed by GitHub
parent 5e389228f6
commit 476a043a5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 285 additions and 286 deletions

View file

@ -161,26 +161,26 @@
</div>
</div>
<div class="ui small basic delete modal" id="delete-email">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-email">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.email_deletion"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.email_deletion_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>
<div class="ui small basic delete modal" id="delete-account">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-account">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.delete_account_title"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.delete_account_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>
{{template "base/footer" .}}

View file

@ -268,8 +268,8 @@
</div>
</div>
<div class="ui small basic delete modal" id="delete-token">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-token">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.access_token_deletion"}}
</div>
@ -277,7 +277,7 @@
<p>{{.locale.Tr "settings.access_token_deletion_desc"}}</p>
</div>
<div class="actions">{{/* TODO: Convert to base/delete_modal_actions.tmpl */}}
<div class="actions">{{/* TODO: Convert to base/modal_actions_confirm.tmpl */}}
<button class="ui green basic inverted cancel button">
{{svg "octicon-x"}}
{{.locale.Tr "settings.access_token_deletion_cancel_action"}}

View file

@ -47,13 +47,13 @@
</form>
</div>
<div class="ui small basic delete modal" id="remove-gitea-oauth2-application">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="remove-gitea-oauth2-application">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.remove_oauth2_application"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.oauth2_application_remove_description"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -28,13 +28,13 @@
</div>
</div>
<div class="ui small basic delete modal" id="revoke-gitea-oauth2-grant">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="revoke-gitea-oauth2-grant">
<div class="header">
{{svg "octicon-shield" 16 "gt-mr-2"}}
{{.locale.Tr "settings.revoke_oauth2_grant"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.revoke_oauth2_grant_description"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -111,13 +111,13 @@
<br>
<p>{{.locale.Tr "settings.gpg_helper" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/about-commit-signature-verification#gpg-commit-signature-verification" | Str2html}}</p>
<div class="ui small basic delete modal" id="delete-gpg">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-gpg">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.gpg_key_deletion"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.gpg_key_deletion_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -54,14 +54,14 @@
</div>
</div>
<div class="ui small basic delete modal" id="delete-principal">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-principal">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.ssh_principal_deletion"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.ssh_principal_deletion_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>
{{end}}

View file

@ -100,13 +100,13 @@
<br>
<p>{{.locale.Tr "settings.ssh_helper" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh" | Str2html}}</p>
<div class="ui small basic delete modal" id="delete-ssh">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-ssh">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.ssh_key_deletion"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.ssh_key_deletion_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -40,14 +40,13 @@
</div>
</div>
</div>
<div class="ui small basic delete modal" id="leave-organization">
<div class="ui icon header">
{{svg "octicon-x" 16 "close inside"}}
<div class="ui gitea-confirm-modal delete modal" id="leave-organization">
<div class="header">
{{$.locale.Tr "org.members.leave"}}
</div>
<div class="content">
<p>{{$.locale.Tr "org.members.leave.detail" `<span class="dataOrganizationName"></span>` | Safe}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>
{{template "base/footer" .}}

View file

@ -38,8 +38,7 @@
<div class="right floated content">
{{if $.allowAdopt}}
<button class="ui button submit tiny green adopt show-modal" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{$.locale.Tr "repo.adopt_preexisting_label"}}</span></button>
<div class="ui basic modal" id="adopt-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="ui gitea-confirm-modal modal" id="adopt-unadopted-modal-{{$dirI}}">
<div class="header">
<span class="label">{{$.locale.Tr "repo.adopt_preexisting"}}</span>
</div>
@ -50,7 +49,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
<div class="actions">
<div class="actions">{{/* TODO: Convert to base/modal_actions_confirm */}}
<button class="ui red basic inverted cancel button">
{{svg "octicon-x"}}
{{$.locale.Tr "modal.no"}}
@ -65,8 +64,7 @@
{{end}}
{{if $.allowDelete}}
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.locale.Tr "repo.delete_preexisting_label"}}</span></button>
<div class="ui basic modal" id="delete-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="ui gitea-confirm-modal modal" id="delete-unadopted-modal-{{$dirI}}">
<div class="header">
<span class="label">{{$.locale.Tr "repo.delete_preexisting"}}</span>
</div>
@ -77,7 +75,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
{{template "base/delete_modal_actions" $}}
{{template "base/modal_actions_confirm" $}}
</form>
</div>
{{end}}
@ -131,14 +129,14 @@
</div>
</div>
<div class="ui small basic delete modal">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.remove_account_link"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.remove_account_link_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>
{{template "base/footer" .}}

View file

@ -41,13 +41,13 @@
</div>
</div>
<div class="ui small basic delete modal" id="delete-account-link">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-account-link">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.remove_account_link"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.remove_account_link_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -51,13 +51,13 @@
</form>
</div>
<div class="ui small basic delete modal" id="delete-openid">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-openid">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.openid_deletion"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.openid_deletion_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -23,13 +23,13 @@
{{end}}
</div>
<div class="ui small basic delete modal" id="disable-twofa">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="disable-twofa">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.twofa_disable"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.twofa_disable_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>

View file

@ -30,13 +30,13 @@
{{template "user/auth/webauthn_error" .}}
<div class="ui small basic delete modal" id="delete-registration">
<div class="ui icon header">
<div class="ui gitea-confirm-modal delete modal" id="delete-registration">
<div class="header">
{{svg "octicon-trash"}}
{{.locale.Tr "settings.webauthn_delete_key"}}
</div>
<div class="content">
<p>{{.locale.Tr "settings.webauthn_delete_key_desc"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
{{template "base/modal_actions_confirm" .}}
</div>