From 5016bc5d5c8df7f9ac6d59545d2aa8751ef7e370 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 24 Mar 2024 19:23:38 +0100 Subject: [PATCH] Migrate `gt-hidden` to `tw-hidden` (#30046) We have to define this one in helpers.css because tailwind only generates a single class but certain things rely on this being double-class. Command ran: ```sh perl -p -i -e 's#gt-hidden#tw-hidden#g' web_src/js/**/* templates/**/* models/**/* web_src/css/**/* --------- Co-authored-by: wxiaoguang (cherry picked from commit ec3d467f15a683b305ac165c3eba6683628dcb25) Conflicts: templates/install.tmpl templates/repo/diff/conversation.tmpl templates/repo/issue/view_content/conversation.tmpl templates/repo/issue/view_content/sidebar.tmpl templates/repo/issue/view_title.tmpl resolved by prefering Forgejo version and applying the commands to all files --- .../contributing/guidelines-frontend.en-us.md | 2 +- .../contributing/guidelines-frontend.zh-cn.md | 2 +- tailwind.config.js | 2 ++ templates/admin/auth/edit.tmpl | 8 +++--- templates/admin/auth/new.tmpl | 6 ++-- templates/admin/auth/source/ldap.tmpl | 14 +++++----- templates/admin/auth/source/oauth.tmpl | 2 +- templates/admin/auth/source/smtp.tmpl | 2 +- templates/admin/auth/source/sspi.tmpl | 2 +- templates/admin/user/edit.tmpl | 8 +++--- templates/admin/user/new.tmpl | 6 ++-- templates/base/head_navbar.tmpl | 6 ++-- templates/install.tmpl | 8 +++--- templates/org/settings/options.tmpl | 2 +- templates/org/team/new.tmpl | 2 +- templates/repo/blame.tmpl | 2 +- .../repo/commit_load_branches_and_tags.tmpl | 2 +- templates/repo/commits_list.tmpl | 2 +- templates/repo/commits_list_small.tmpl | 2 +- templates/repo/create.tmpl | 2 +- templates/repo/diff/box.tmpl | 14 +++++----- templates/repo/diff/comment_form.tmpl | 2 +- templates/repo/diff/comments.tmpl | 4 +-- templates/repo/diff/compare.tmpl | 12 ++++---- templates/repo/diff/conversation.tmpl | 4 +-- templates/repo/editor/commit_form.tmpl | 2 +- templates/repo/editor/edit.tmpl | 2 +- templates/repo/editor/patch.tmpl | 2 +- templates/repo/find/files.tmpl | 2 +- templates/repo/graph.tmpl | 2 +- templates/repo/home.tmpl | 2 +- .../repo/issue/branch_selector_field.tmpl | 2 +- templates/repo/issue/fields/checkboxes.tmpl | 4 +-- templates/repo/issue/fields/dropdown.tmpl | 2 +- templates/repo/issue/fields/input.tmpl | 2 +- templates/repo/issue/fields/markdown.tmpl | 2 +- templates/repo/issue/fields/textarea.tmpl | 6 ++-- .../repo/issue/labels/edit_delete_label.tmpl | 2 +- templates/repo/issue/labels/label.tmpl | 2 +- .../repo/issue/labels/labels_sidebar.tmpl | 2 +- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/new_form.tmpl | 8 +++--- templates/repo/issue/search.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 6 ++-- .../repo/issue/view_content/comments.tmpl | 8 +++--- .../repo/issue/view_content/conversation.tmpl | 12 ++++---- .../view_content/pull_merge_instruction.tmpl | 12 ++++---- .../repo/issue/view_content/sidebar.tmpl | 12 ++++---- templates/repo/issue/view_title.tmpl | 8 +++--- templates/repo/latest_commit.tmpl | 2 +- templates/repo/migrate/migrating.tmpl | 6 ++-- templates/repo/migrate/options.tmpl | 4 +-- templates/repo/settings/deploy_keys.tmpl | 2 +- templates/repo/settings/githook_edit.tmpl | 2 +- templates/repo/settings/lfs_file.tmpl | 2 +- templates/repo/settings/protected_branch.tmpl | 2 +- templates/repo/settings/webhook/history.tmpl | 2 +- templates/repo/settings/webhook/settings.tmpl | 2 +- templates/repo/sub_menu.tmpl | 2 +- templates/repo/view_file.tmpl | 4 +-- templates/repo/wiki/view.tmpl | 2 +- templates/user/auth/webauthn_error.tmpl | 4 +-- templates/user/dashboard/issues.tmpl | 2 +- .../user/notification/notification_div.tmpl | 4 +-- templates/user/settings/applications.tmpl | 2 +- templates/user/settings/keys_gpg.tmpl | 2 +- templates/user/settings/keys_principal.tmpl | 2 +- templates/user/settings/keys_ssh.tmpl | 2 +- templates/user/settings/profile.tmpl | 4 +-- web_src/css/helpers.css | 6 ++-- web_src/css/modules/button.css | 5 ++-- web_src/css/shared/flex-list.css | 2 +- web_src/js/features/comp/LabelEdit.js | 6 ++-- web_src/js/features/notification.js | 6 ++-- web_src/js/features/repo-diff.js | 8 +++--- web_src/js/features/repo-graph.js | 12 ++++---- web_src/js/features/repo-issue-content.js | 4 +-- web_src/js/features/repo-issue.js | 28 +++++++++---------- web_src/js/features/repo-legacy.js | 18 ++++++------ web_src/js/markup/mermaid.js | 4 +-- web_src/js/svg.js | 2 +- web_src/js/utils/dom.js | 8 +++--- 82 files changed, 195 insertions(+), 192 deletions(-) diff --git a/docs/content/contributing/guidelines-frontend.en-us.md b/docs/content/contributing/guidelines-frontend.en-us.md index b19101dd47..8813634f93 100644 --- a/docs/content/contributing/guidelines-frontend.en-us.md +++ b/docs/content/contributing/guidelines-frontend.en-us.md @@ -118,7 +118,7 @@ However, there are still some special cases, so the current guideline is: ### Show/Hide Elements * Vue components are recommended to use `v-if` and `v-show` to show/hide elements. -* Go template code should use Gitea's `.gt-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.gt-hidden`'s comment. +* Go template code should use `.tw-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.tw-hidden`'s comment. ### Styles and Attributes in Go HTML Template diff --git a/docs/content/contributing/guidelines-frontend.zh-cn.md b/docs/content/contributing/guidelines-frontend.zh-cn.md index 961a331ac2..2b502434a4 100644 --- a/docs/content/contributing/guidelines-frontend.zh-cn.md +++ b/docs/content/contributing/guidelines-frontend.zh-cn.md @@ -117,7 +117,7 @@ Gitea使用一些补丁使Fomantic UI更具可访问性(参见`aria.js`和`ari ### 显示/隐藏元素 * 推荐在Vue组件中使用`v-if`和`v-show`来显示/隐藏元素。 -* Go 模板代码应使用 Gitea 的 `.gt-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-hidden`的注释以获取更多详细信息。 +* Go 模板代码应使用 `.tw-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。 ### Go HTML 模板中的样式和属性 diff --git a/tailwind.config.js b/tailwind.config.js index 0754ab3631..5bce37e023 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -41,6 +41,8 @@ export default { // classes that don't work without CSS variables from "@tailwind base" which we don't use 'transform', 'shadow', 'ring', 'blur', 'grayscale', 'invert', '!invert', 'filter', '!filter', 'backdrop-filter', + // we use double-class tw-hidden defined in web_src/css/helpers.css for increased specificity + 'hidden', // unneeded classes '[-a-zA-Z:0-9_.]', ], diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 2187761828..687a277a84 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -42,7 +42,7 @@ -
+
@@ -113,7 +113,7 @@
-
+
@@ -148,7 +148,7 @@
-
+
@@ -205,7 +205,7 @@

{{ctx.Locale.Tr "admin.auths.force_smtps_helper"}}

-
+
diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl index 255eac202c..f6a14e1f7d 100644 --- a/templates/admin/auth/new.tmpl +++ b/templates/admin/auth/new.tmpl @@ -33,13 +33,13 @@ {{template "admin/auth/source/smtp" .}} -
+
-
+
@@ -59,7 +59,7 @@
-
+
diff --git a/templates/admin/auth/source/ldap.tmpl b/templates/admin/auth/source/ldap.tmpl index b945a1ab1c..680849c8ea 100644 --- a/templates/admin/auth/source/ldap.tmpl +++ b/templates/admin/auth/source/ldap.tmpl @@ -1,4 +1,4 @@ -
+
-
+
-
+
-
+
@@ -38,7 +38,7 @@
-
+
@@ -115,13 +115,13 @@
-
+
-
+
diff --git a/templates/admin/auth/source/oauth.tmpl b/templates/admin/auth/source/oauth.tmpl index da3a4f913a..0560cc8256 100644 --- a/templates/admin/auth/source/oauth.tmpl +++ b/templates/admin/auth/source/oauth.tmpl @@ -1,4 +1,4 @@ -
+