diff options
author | Hester Gong <hestergong@gmail.com> | 2023-04-23 17:24:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 17:24:19 +0800 |
commit | 476a043a5fb2b472e2aaced450ac2a0c9102854e (patch) | |
tree | fcbc301d7fca09eee292cdd039a6980a88aefa63 /templates/admin | |
parent | 5e389228f61844c0d59d5bc5974483dae0aa1b8b (diff) | |
download | gitea-476a043a5fb2b472e2aaced450ac2a0c9102854e.tar.gz gitea-476a043a5fb2b472e2aaced450ac2a0c9102854e.zip |
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](https://github.com/go-gitea/gitea/blob/4299c3b7db61f8741eca0ba3d663bb65745a4acc/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>
Diffstat (limited to 'templates/admin')
-rw-r--r-- | templates/admin/auth/edit.tmpl | 6 | ||||
-rw-r--r-- | templates/admin/emails/list.tmpl | 8 | ||||
-rw-r--r-- | templates/admin/monitor.tmpl | 7 | ||||
-rw-r--r-- | templates/admin/notice.tmpl | 1 | ||||
-rw-r--r-- | templates/admin/packages/list.tmpl | 6 | ||||
-rw-r--r-- | templates/admin/queue.tmpl | 7 | ||||
-rw-r--r-- | templates/admin/repo/list.tmpl | 6 | ||||
-rw-r--r-- | templates/admin/repo/unadopted.tmpl | 10 | ||||
-rw-r--r-- | templates/admin/stacktrace.tmpl | 7 | ||||
-rw-r--r-- | templates/admin/user/edit.tmpl | 6 |
10 files changed, 29 insertions, 35 deletions
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 49007e572d..c3ff228ac0 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -440,14 +440,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 "admin.auths.delete_auth_title"}} </div> <div class="content"> <p>{{.locale.Tr "admin.auths.delete_auth_desc"}}</p> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index d8fa986cff..61af571095 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -73,11 +73,11 @@ {{template "base/paginate" .}} - <div class="ui basic modal" id="change-email-modal"> - <div class="ui icon header"> + <div class="ui gitea-confirm-modal modal" id="change-email-modal"> + <div class="header"> {{.locale.Tr "admin.emails.change_email_header"}} </div> - <div class="content center"> + <div class="content"> <p class="center">{{.locale.Tr "admin.emails.change_email_text"}}</p> <form class="ui form" id="email-action-form" action="{{AppSubUrl}}/admin/emails/activate" method="post"> @@ -94,7 +94,7 @@ <input type="hidden" id="form-activate" name="activate" value="" required> <div class="center"> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> </form> </div> diff --git a/templates/admin/monitor.tmpl b/templates/admin/monitor.tmpl index d53e9e18dc..4d66d3bfbb 100644 --- a/templates/admin/monitor.tmpl +++ b/templates/admin/monitor.tmpl @@ -37,15 +37,14 @@ {{template "admin/process" .}} </div> </div> -<div class="ui small basic delete modal"> - <div class="ui icon header"> - {{svg "octicon-x" 16 "close inside"}} +<div class="ui gitea-confirm-modal delete modal"> + <div class="header"> {{.locale.Tr "admin.monitor.process.cancel"}} </div> <div class="content"> <p>{{$.locale.Tr "admin.monitor.process.cancel_notices" `<span class="name"></span>` | Safe}}</p> <p>{{$.locale.Tr "admin.monitor.process.cancel_desc"}}</p> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl index dd17bde036..850b6333f2 100644 --- a/templates/admin/notice.tmpl +++ b/templates/admin/notice.tmpl @@ -72,7 +72,6 @@ </div> <div class="ui modal admin" id="detail-modal"> - {{svg "octicon-x" 16 "close inside"}} <div class="header">{{$.locale.Tr "admin.notices.view_detail_header"}}</div> <div class="content"> <div class="sub header"></div> diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index 121f575861..6b3480d427 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -80,14 +80,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 "packages.settings.delete"}} </div> <div class="content"> {{.locale.Tr "packages.settings.delete.notice" `<span class="name"></span>` `<span class="dataVersion"></span>` | Safe}} </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/queue.tmpl b/templates/admin/queue.tmpl index 767c235a38..10c35bd599 100644 --- a/templates/admin/queue.tmpl +++ b/templates/admin/queue.tmpl @@ -181,16 +181,15 @@ </div> </div> </div> -<div class="ui small basic delete modal"> - <div class="ui icon header"> - {{svg "octicon-x" 16 "close inside"}} +<div class="ui gitea-confirm-modal delete modal"> + <div class="header"> {{.locale.Tr "admin.monitor.queue.pool.cancel"}} </div> <div class="content"> <p>{{$.locale.Tr "admin.monitor.queue.pool.cancel_notices" `<span class="name"></span>` | Safe}}</p> <p>{{$.locale.Tr "admin.monitor.queue.pool.cancel_desc"}}</p> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index f8e2bbc844..1574a37668 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -95,8 +95,8 @@ </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 "repo.settings.delete"}} </div> @@ -105,6 +105,6 @@ {{.locale.Tr "repo.settings.delete_notices_2" `<span class="name"></span>` | Safe}}<br> {{.locale.Tr "repo.settings.delete_notices_fork_1"}}<br> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl index a8e04850d0..fbb0bdf0e8 100644 --- a/templates/admin/repo/unadopted.tmpl +++ b/templates/admin/repo/unadopted.tmpl @@ -29,8 +29,7 @@ <span class="name">{{$dir}}</span> <div class="right floated content"> <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> @@ -43,7 +42,7 @@ <input type="hidden" name="action" value="adopt"> <input type="hidden" name="q" value="{{$.Keyword}}"> <input type="hidden" name="page" value="{{$.CurrentPage}}"> - <div class="actions"> + <div class="actions">{{/* TODO: Convert to base/modal_actions_confirm */}} <button class="ui red basic inverted cancel button"> {{svg "octicon-trash" 16 "gt-mr-2"}} {{$.locale.Tr "modal.no"}} @@ -56,8 +55,7 @@ </form> </div> <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> @@ -70,7 +68,7 @@ <input type="hidden" name="action" value="delete"> <input type="hidden" name="q" value="{{$.Keyword}}"> <input type="hidden" name="page" value="{{$.CurrentPage}}"> - <div class="actions"> + <div class="actions">{{/* TODO: Convert to base/modal_actions_confirm */}} <button class="ui red basic inverted cancel button"> {{svg "octicon-trash" 16 "gt-mr-2"}} {{$.locale.Tr "modal.no"}} diff --git a/templates/admin/stacktrace.tmpl b/templates/admin/stacktrace.tmpl index 4e16036ae3..2bef11fcf6 100644 --- a/templates/admin/stacktrace.tmpl +++ b/templates/admin/stacktrace.tmpl @@ -18,16 +18,15 @@ </div> </div> </div> -<div class="ui small basic delete modal"> - <div class="ui icon header"> - {{svg "octicon-x" 16 "close inside"}} +<div class="ui gitea-confirm-modal delete modal"> + <div class="header"> {{.locale.Tr "admin.monitor.process.cancel"}} </div> <div class="content"> <p>{{$.locale.Tr "admin.monitor.process.cancel_notices" `<span class="name"></span>` | Safe}}</p> <p>{{$.locale.Tr "admin.monitor.process.cancel_desc"}}</p> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </div> {{template "base/footer" .}} diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 4fd0d892f2..6d916ae207 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -196,8 +196,8 @@ </div> </div> -<div class="ui small basic delete modal" id="delete-user-modal"> - <div class="ui icon header"> +<div class="ui gitea-confirm-modal delete modal" id="delete-user-modal"> + <div class="header"> {{svg "octicon-trash"}} {{.locale.Tr "settings.delete_account_title"}} </div> @@ -213,7 +213,7 @@ </div> <p class="help">{{.locale.Tr "admin.users.purge_help"}}</p> </div> - {{template "base/delete_modal_actions" .}} + {{template "base/modal_actions_confirm" .}} </form> </div> {{template "base/footer" .}} |