From 48e3e38ee040c9cfec6ea2adea2da49a7f21f2c7 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 4 May 2023 02:32:10 +0800 Subject: [PATCH] Clean up polluted styles and remove dead CSS code (#24497) Follow #24393 The funny history: * At the beginning, `.ui.message` was polluted by `text-align: center` * Then people do `
` * But `.ui.left` is polluted by `float: left` * Then people do `#xxx .ui.message { width: 100% !important;}` The code just becomes more and more hacky. After removing the pollution, everything becomes clear and straight. And, this PR also does: 1. Remove the `package.css`, its styles could be provided by `top aligned` 2. Remove `#avatar-arrow`, dead code Screenshot: ![image](https://user-images.githubusercontent.com/2114189/235862130-a9eb5d8f-7d01-457c-99f7-21d0abc3075e.png) ![image](https://user-images.githubusercontent.com/2114189/235862222-139709a7-95c2-4f89-a40f-100b2d76d9bb.png) Co-authored-by: Giteabot --- templates/base/alert.tmpl | 8 ++--- templates/package/content/container.tmpl | 6 ++-- templates/package/settings.tmpl | 2 +- templates/repo/issue/view_content/pull.tmpl | 2 +- .../repo/issue/view_content/sidebar.tmpl | 2 +- templates/repo/migrate/migrating.tmpl | 2 +- templates/repo/settings/options.tmpl | 10 +++--- web_src/css/base.css | 2 +- web_src/css/index.css | 1 - web_src/css/package.css | 7 ---- web_src/css/repository.css | 33 ------------------- 11 files changed, 17 insertions(+), 58 deletions(-) delete mode 100644 web_src/css/package.css diff --git a/templates/base/alert.tmpl b/templates/base/alert.tmpl index b8a04b89a9..160584f769 100644 --- a/templates/base/alert.tmpl +++ b/templates/base/alert.tmpl @@ -1,20 +1,20 @@ {{if .Flash.ErrorMsg}} -
+

{{.Flash.ErrorMsg | Str2html}}

{{end}} {{if .Flash.SuccessMsg}} -
+

{{.Flash.SuccessMsg | Str2html}}

{{end}} {{if .Flash.InfoMsg}} -
+

{{.Flash.InfoMsg | Str2html}}

{{end}} {{if .Flash.WarningMsg}} -
+

{{.Flash.WarningMsg | Str2html}}

{{end}} diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl index 3370ebca3f..d928b36e60 100644 --- a/templates/package/content/container.tmpl +++ b/templates/package/content/container.tmpl @@ -69,7 +69,7 @@ {{if .PackageDescriptor.Metadata.Labels}}

{{.locale.Tr "packages.container.labels"}}

- +
@@ -79,8 +79,8 @@ {{range $key, $value := .PackageDescriptor.Metadata.Labels}} - - + + {{end}} diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl index 7beb3da062..205d875c3e 100644 --- a/templates/package/settings.tmpl +++ b/templates/package/settings.tmpl @@ -51,7 +51,7 @@ {{.locale.Tr "packages.settings.delete"}}
-
+
{{.locale.Tr "packages.settings.delete.notice" .PackageDescriptor.Package.Name .PackageDescriptor.Version.Version}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index ec957161b1..29d8d9d47c 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -47,7 +47,7 @@ {{$.locale.Tr "repo.issues.dismiss_review"}}
-
+
{{$.locale.Tr "repo.issues.dismiss_review_warning"}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index e07ef0fa37..86796a91cb 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -560,7 +560,7 @@ {{end}}
-
+
{{if .Issue.IsLocked}} {{.locale.Tr "repo.issues.unlock.notice_1"}}
{{.locale.Tr "repo.issues.unlock.notice_2"}}
diff --git a/templates/repo/migrate/migrating.tmpl b/templates/repo/migrate/migrating.tmpl index 51caa28aa1..72c3fe5664 100644 --- a/templates/repo/migrate/migrating.tmpl +++ b/templates/repo/migrate/migrating.tmpl @@ -50,7 +50,7 @@ {{.locale.Tr "repo.settings.delete"}}
-
+
{{.locale.Tr "repo.settings.delete_notices_1" | Safe}}
{{.locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe}} {{if .Repository.NumForks}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 515854609a..af753ba670 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -803,7 +803,7 @@ {{.locale.Tr "repo.settings.convert"}}
-
+
{{.locale.Tr "repo.settings.convert_notices_1"}}
@@ -834,7 +834,7 @@ {{.locale.Tr "repo.settings.convert_fork"}}
-
+
{{.locale.Tr "repo.settings.convert_fork_notices_1"}}
@@ -864,7 +864,7 @@ {{.locale.Tr "repo.settings.transfer"}}
-
+
{{.locale.Tr "repo.settings.transfer_notices_1"}}
{{.locale.Tr "repo.settings.transfer_notices_2"}}
{{.locale.Tr "repo.settings.transfer_notices_3"}} @@ -900,7 +900,7 @@ {{.locale.Tr "repo.settings.delete"}}
-
+
{{.locale.Tr "repo.settings.delete_notices_1" | Safe}}
{{.locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe}} {{if .Repository.NumForks}}
@@ -935,7 +935,7 @@ {{.locale.Tr "repo.settings.wiki_delete"}}
-
+
{{.locale.Tr "repo.settings.delete_notices_1" | Safe}}
{{.locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name | Safe}}
diff --git a/web_src/css/base.css b/web_src/css/base.css index 0f94d22312..d854f9badd 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1556,7 +1556,7 @@ img.ui.avatar, vertical-align: middle; } -.ui .message { +.ui .message.flash-message { text-align: center; } diff --git a/web_src/css/index.css b/web_src/css/index.css index 12cb94c041..6fb92f2ecb 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -41,6 +41,5 @@ @import "./admin.css"; @import "./explore.css"; @import "./review.css"; -@import "./package.css"; @import "./runner.css"; @import "./helpers.css"; diff --git a/web_src/css/package.css b/web_src/css/package.css deleted file mode 100644 index c229e176f5..0000000000 --- a/web_src/css/package.css +++ /dev/null @@ -1,7 +0,0 @@ -.container-labels td:nth-child(1) { - vertical-align: top; -} - -.container-labels td:nth-child(2) { - overflow-wrap: anywhere; -} diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 5b32fbb95e..d724dc400a 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -2600,39 +2600,6 @@ height: 15px; } -#avatar-arrow::before, -#avatar-arrow::after { - right: 100%; - top: 20px; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; -} - -#avatar-arrow::before { - border-right-color: var(--color-secondary); - border-width: 9px; - margin-top: -9px; -} - -#avatar-arrow::after { - border-right-color: var(--color-box-header); - border-width: 8px; - margin-top: -8px; -} - -#transfer-repo-modal .ui.message, -#delete-repo-modal .ui.message, -#delete-wiki-modal .ui.message, -#convert-fork-repo-modal .ui.message, -#convert-mirror-repo-modal .ui.message, -#fork-repo-modal .ui.message { - width: 100% !important; -} - .tab-size-1 { tab-size: 1 !important; -moz-tab-size: 1 !important;
{{.locale.Tr "packages.container.labels.key"}}
{{$key}}{{$value}}{{$key}}{{$value}}