From f88ad5424f381bf2a45fd863b551c5a72891bb68 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 22 Mar 2024 14:45:10 +0100 Subject: [PATCH] Replace 10 more gt- classes with tw- (#29945) Likely the biggest change of the tailwind refactors. Only thing of note is that `tw-flex-1` resolves to `flex: 1 1 0%` while our `gt-f1` was `flex: 1 1 0`, I don't think it will make any difference. Commands I've ran: ```sh perl -p -i -e 's#gt-vm#tw-align-middle#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-fw#tw-flex-wrap#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-f1#tw-flex-1#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-fc#tw-flex-col#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-sb#tw-justify-between#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-je#tw-justify-end#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-jc#tw-justify-center#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-ac#tw-content-center#g' web_src/js/**/* templates/**/* models/**/* tests/**/* perl -p -i -e 's#gt-df#tw-flex#g' web_src/js/**/* templates/**/* models/**/* tests/**/* perl -p -i -e 's#gt-dib#tw-inline-block#g' web_src/js/**/* templates/**/* models/**/* tests/**/* Co-authored-by: wxiaoguang --- .../contributing/guidelines-frontend.en-us.md | 2 +- .../contributing/guidelines-frontend.zh-cn.md | 2 +- models/avatars/avatar.go | 2 +- templates/admin/emails/list.tmpl | 4 +- templates/admin/notice.tmpl | 2 +- templates/admin/org/list.tmpl | 4 +- templates/admin/queue_manage.tmpl | 2 +- templates/admin/repo/unadopted.tmpl | 4 +- templates/admin/stacktrace-row.tmpl | 8 ++-- templates/admin/stacktrace.tmpl | 4 +- templates/admin/user/list.tmpl | 2 +- templates/admin/user/view.tmpl | 4 +- templates/base/head_navbar.tmpl | 8 ++-- templates/devtest/fomantic-modal.tmpl | 2 +- templates/devtest/tmplerr.tmpl | 2 +- templates/explore/search.tmpl | 4 +- templates/explore/user_list.tmpl | 2 +- templates/org/header.tmpl | 6 +-- templates/org/home.tmpl | 12 ++--- templates/org/member/members.tmpl | 2 +- templates/org/settings/labels.tmpl | 4 +- templates/org/team/members.tmpl | 6 +-- templates/org/team/new.tmpl | 6 +-- templates/org/team/repositories.tmpl | 8 ++-- templates/package/view.tmpl | 4 +- templates/projects/list.tmpl | 2 +- templates/projects/view.tmpl | 2 +- templates/repo/actions/list.tmpl | 2 +- templates/repo/actions/runs_list.tmpl | 2 +- templates/repo/actions/status.tmpl | 2 +- templates/repo/blame.tmpl | 6 +-- templates/repo/branch/list.tmpl | 10 ++--- templates/repo/branch_dropdown.tmpl | 4 +- .../code/recently_pushed_new_branches.tmpl | 4 +- .../repo/commit_load_branches_and_tags.tmpl | 8 ++-- templates/repo/commit_page.tmpl | 16 +++---- templates/repo/commit_statuses.tmpl | 4 +- templates/repo/commits.tmpl | 2 +- templates/repo/commits_list_small.tmpl | 2 +- templates/repo/commits_table.tmpl | 4 +- templates/repo/diff/blob_excerpt.tmpl | 4 +- templates/repo/diff/box.tmpl | 16 +++---- templates/repo/diff/comments.tmpl | 6 +-- templates/repo/diff/conversation.tmpl | 12 ++--- templates/repo/diff/new_review.tmpl | 10 ++--- templates/repo/diff/section_split.tmpl | 2 +- templates/repo/diff/section_unified.tmpl | 2 +- templates/repo/find/files.tmpl | 4 +- templates/repo/forks.tmpl | 2 +- templates/repo/graph/commits.tmpl | 8 ++-- templates/repo/header.tmpl | 2 +- templates/repo/home.tmpl | 14 +++--- templates/repo/icon.tmpl | 2 +- templates/repo/issue/card.tmpl | 16 +++---- templates/repo/issue/filter_actions.tmpl | 2 +- templates/repo/issue/filter_list.tmpl | 6 +-- templates/repo/issue/label_precolors.tmpl | 4 +- templates/repo/issue/labels/label_list.tmpl | 4 +- templates/repo/issue/milestone_issues.tmpl | 10 ++--- templates/repo/issue/milestones.tmpl | 2 +- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 6 +-- .../repo/issue/view_content/attachments.tmpl | 6 +-- .../repo/issue/view_content/comments.tmpl | 14 +++--- .../repo/issue/view_content/conversation.tmpl | 16 +++---- templates/repo/issue/view_content/pull.tmpl | 6 +-- .../repo/issue/view_content/sidebar.tmpl | 44 +++++++++---------- .../view_content/update_branch_by_merge.tmpl | 2 +- templates/repo/issue/view_title.tmpl | 2 +- templates/repo/migrate/migrate.tmpl | 2 +- templates/repo/projects/view.tmpl | 2 +- templates/repo/pulls/fork.tmpl | 2 +- templates/repo/pulls/tab_menu.tmpl | 2 +- templates/repo/release/list.tmpl | 4 +- templates/repo/release/new.tmpl | 6 +-- templates/repo/release_tag_header.tmpl | 4 +- templates/repo/settings/branches.tmpl | 6 +-- templates/repo/settings/collaboration.tmpl | 6 +-- templates/repo/settings/githooks.tmpl | 2 +- templates/repo/settings/options.tmpl | 8 ++-- templates/repo/settings/tags.tmpl | 2 +- .../repo/settings/webhook/base_list.tmpl | 2 +- templates/repo/settings/webhook/history.tmpl | 2 +- templates/repo/tag/list.tmpl | 8 ++-- templates/repo/view_file.tmpl | 6 +-- templates/repo/wiki/new.tmpl | 2 +- templates/repo/wiki/pages.tmpl | 2 +- templates/repo/wiki/view.tmpl | 2 +- templates/shared/actions/runner_edit.tmpl | 8 ++-- templates/shared/search/code/results.tmpl | 8 ++-- templates/shared/searchbottom.tmpl | 4 +- templates/shared/secrets/add_list.tmpl | 2 +- templates/shared/user/org_profile_avatar.tmpl | 2 +- templates/shared/user/profile_big_avatar.tmpl | 6 +-- templates/shared/variables/variable_list.tmpl | 2 +- templates/status/500.tmpl | 4 +- templates/user/auth/signin_inner.tmpl | 6 +-- templates/user/auth/signup_inner.tmpl | 6 +-- templates/user/auth/webauthn.tmpl | 2 +- templates/user/dashboard/feeds.tmpl | 2 +- templates/user/dashboard/milestones.tmpl | 2 +- .../user/notification/notification_div.tmpl | 12 ++--- .../notification_subscriptions.tmpl | 6 +-- templates/user/settings/account.tmpl | 2 +- .../settings/applications_oauth2_list.tmpl | 2 +- templates/user/settings/repos.tmpl | 4 +- templates/user/settings/security/openid.tmpl | 2 +- templates/webhook/new.tmpl | 2 +- tests/integration/release_test.go | 2 +- web_src/css/actions.css | 4 -- web_src/css/helpers.css | 10 ----- web_src/js/components/ActionRunStatus.vue | 2 +- web_src/js/components/DashboardRepoList.vue | 20 ++++----- web_src/js/components/DiffCommitSelector.vue | 2 +- web_src/js/components/DiffFileList.vue | 4 +- web_src/js/components/DiffFileTreeItem.vue | 2 +- .../js/components/PullRequestMergeForm.vue | 2 +- .../js/components/RepoBranchTagSelector.vue | 4 +- web_src/js/components/RepoCodeFrequency.vue | 4 +- web_src/js/components/RepoContributors.vue | 10 ++--- web_src/js/components/RepoRecentCommits.vue | 4 +- web_src/js/features/repo-issue-content.js | 2 +- web_src/js/features/repo-issue-list.js | 2 +- 123 files changed, 308 insertions(+), 322 deletions(-) diff --git a/docs/content/contributing/guidelines-frontend.en-us.md b/docs/content/contributing/guidelines-frontend.en-us.md index 2c0aaaed4a3..eec4a88fd04 100644 --- a/docs/content/contributing/guidelines-frontend.en-us.md +++ b/docs/content/contributing/guidelines-frontend.en-us.md @@ -47,7 +47,7 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h 9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided. 10. Avoid mixing different events in one event listener, prefer to use individual event listeners for every event. 11. Custom event names are recommended to use `ce-` prefix. -12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-df`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`). +12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-mono`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`). 13. Avoid inline scripts & styles as much as possible, it's recommended to put JS code into JS files and use CSS classes. If inline scripts & styles are unavoidable, explain the reason why it can't be avoided. ### Accessibility / ARIA diff --git a/docs/content/contributing/guidelines-frontend.zh-cn.md b/docs/content/contributing/guidelines-frontend.zh-cn.md index b5fb8964b34..040dba3d765 100644 --- a/docs/content/contributing/guidelines-frontend.zh-cn.md +++ b/docs/content/contributing/guidelines-frontend.zh-cn.md @@ -47,7 +47,7 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。 9. 避免在 CSS 中使用不必要的`!important`,如果无法避免,添加注释解释为什么需要它。 10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。 11. 推荐使用自定义事件名称前缀`ce-`。 -12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-df`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。 +12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-mono`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。 13. 尽量避免内联脚本和样式,建议将JS代码放入JS文件中并使用CSS类。如果内联脚本和样式不可避免,请解释无法避免的原因。 ### 可访问性 / ARIA diff --git a/models/avatars/avatar.go b/models/avatars/avatar.go index bbe16483bf7..9c56e0f9a0f 100644 --- a/models/avatars/avatar.go +++ b/models/avatars/avatar.go @@ -24,7 +24,7 @@ import ( const ( // DefaultAvatarClass is the default class of a rendered avatar - DefaultAvatarClass = "ui avatar gt-vm" + DefaultAvatarClass = "ui avatar tw-align-middle" // DefaultAvatarPixelSize is the default size in pixels of a rendered avatar DefaultAvatarPixelSize = 28 ) diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index 660df55999e..0b5249fbd98 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -4,8 +4,8 @@ {{ctx.Locale.Tr "admin.emails.email_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}})
-