From 476a043a5fb2b472e2aaced450ac2a0c9102854e Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Sun, 23 Apr 2023 17:24:19 +0800 Subject: [PATCH] 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 Screen Shot 2023-04-23 at 15 17 12 Screen Shot 2023-04-23 at 15 17 21 Test for functionalities: https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov --------- Co-authored-by: wxiaoguang --- options/locale/locale_en-US.ini | 2 + templates/admin/auth/edit.tmpl | 6 +-- templates/admin/emails/list.tmpl | 8 ++-- templates/admin/monitor.tmpl | 7 ++- templates/admin/notice.tmpl | 1 - templates/admin/packages/list.tmpl | 6 +-- templates/admin/queue.tmpl | 7 ++- templates/admin/repo/list.tmpl | 6 +-- templates/admin/repo/unadopted.tmpl | 10 ++-- templates/admin/stacktrace.tmpl | 7 ++- templates/admin/user/edit.tmpl | 6 +-- templates/base/delete_modal_actions.tmpl | 10 ---- templates/base/modal_actions_confirm.tmpl | 21 +++++++++ templates/org/member/members.tmpl | 14 +++--- templates/org/settings/delete.tmpl | 6 +-- templates/org/team/members.tmpl | 7 ++- templates/org/team/new.tmpl | 6 +-- templates/org/team/repositories.tmpl | 12 ++--- templates/org/team/sidebar.tmpl | 7 ++- templates/org/team/teams.tmpl | 7 ++- templates/package/settings.tmpl | 2 +- templates/projects/list.tmpl | 6 +-- templates/projects/view.tmpl | 35 ++++++-------- templates/repo/branch/list.tmpl | 6 +-- templates/repo/commit_page.tmpl | 6 +-- templates/repo/editor/edit.tmpl | 4 +- templates/repo/editor/patch.tmpl | 4 +- templates/repo/header.tmpl | 1 - .../repo/issue/labels/edit_delete_label.tmpl | 6 +-- templates/repo/issue/milestones.tmpl | 6 +-- templates/repo/issue/view_content.tmpl | 6 +-- .../view_content/comments_delete_time.tmpl | 2 +- .../repo/issue/view_content/sidebar.tmpl | 28 ++++------- templates/repo/projects/list.tmpl | 6 +-- templates/repo/projects/view.tmpl | 35 ++++++-------- templates/repo/release/list.tmpl | 8 ++-- templates/repo/release/new.tmpl | 6 +-- templates/repo/settings/branches.tmpl | 8 ++-- templates/repo/settings/collaboration.tmpl | 6 +-- templates/repo/settings/deploy_keys.tmpl | 6 +-- templates/repo/settings/lfs.tmpl | 8 ++-- templates/repo/settings/options.tmpl | 8 ++-- .../repo/settings/webhook/delete_modal.tmpl | 6 +-- templates/repo/wiki/view.tmpl | 6 +-- templates/shared/actions/runner_edit.tmpl | 6 +-- templates/shared/secrets/add_list.tmpl | 8 ++-- templates/user/settings/account.tmpl | 12 ++--- templates/user/settings/applications.tmpl | 6 +-- .../settings/applications_oauth2_list.tmpl | 6 +-- templates/user/settings/grants_oauth2.tmpl | 6 +-- templates/user/settings/keys_gpg.tmpl | 6 +-- templates/user/settings/keys_principal.tmpl | 6 +-- templates/user/settings/keys_ssh.tmpl | 6 +-- templates/user/settings/organization.tmpl | 7 ++- templates/user/settings/repos.tmpl | 16 +++---- .../user/settings/security/accountlinks.tmpl | 6 +-- templates/user/settings/security/openid.tmpl | 6 +-- templates/user/settings/security/twofa.tmpl | 6 +-- .../user/settings/security/webauthn.tmpl | 6 +-- web_src/css/base.css | 26 ---------- web_src/css/index.css | 1 + web_src/css/modules/modal.css | 47 +++++++++++++++++++ web_src/js/features/repo-projects.js | 17 ++++--- 63 files changed, 285 insertions(+), 286 deletions(-) delete mode 100644 templates/base/delete_modal_actions.tmpl create mode 100644 templates/base/modal_actions_confirm.tmpl create mode 100644 web_src/css/modules/modal.css diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c0e94d3b8..b4233d65d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -462,6 +462,8 @@ team_invite.text_3 = Note: This invitation was intended for %[1]s. If you were n [modal] yes = Yes no = No +confirm = Confirm +cancel = Cancel modify = Update [form] diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 49007e572..c3ff228ac 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -440,14 +440,14 @@ -