From 96d3a03a08d4ac20d2356d6ea84e8c335e9382f2 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 8 Dec 2024 10:35:28 +0800 Subject: [PATCH] Refactor LabelEdit (#32752) And fix a regression: https://github.com/go-gitea/gitea/pull/30053#discussion_r1874405470 Major changes: * rewrite without jquery * remove the "delete modal", using "link-action" is good enough * merge "new modal" and "edit modal" --- templates/org/settings/labels.tmpl | 24 ++- templates/repo/issue/labels.tmpl | 10 +- ...elete_label.tmpl => label_edit_modal.tmpl} | 25 +-- templates/repo/issue/labels/label_list.tmpl | 18 +- templates/repo/issue/labels/label_new.tmpl | 48 ------ web_src/css/repo.css | 11 -- web_src/js/features/common-organization.ts | 2 +- web_src/js/features/comp/LabelEdit.ts | 163 ++++++++---------- web_src/js/features/repo-legacy.ts | 2 +- 9 files changed, 110 insertions(+), 193 deletions(-) rename templates/repo/issue/labels/{edit_delete_label.tmpl => label_edit_modal.tmpl} (79%) delete mode 100644 templates/repo/issue/labels/label_new.tmpl diff --git a/templates/org/settings/labels.tmpl b/templates/org/settings/labels.tmpl index 25a562c975..21d7c0ef3c 100644 --- a/templates/org/settings/labels.tmpl +++ b/templates/org/settings/labels.tmpl @@ -1,15 +1,13 @@ {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}} -
-
-
- {{ctx.Locale.Tr "org.settings.labels_desc"}} -
- -
-
- {{template "repo/issue/labels/label_new" .}} - {{template "repo/issue/labels/label_list" .}} -
-{{template "repo/issue/labels/edit_delete_label" .}} +
+
+
+ {{ctx.Locale.Tr "org.settings.labels_desc"}} +
+ +
+
+ {{template "repo/issue/labels/label_list" .}} + {{template "repo/issue/labels/label_edit_modal" .}} +
{{template "org/settings/layout_footer" .}} - diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl index 230777efcc..317fe09000 100644 --- a/templates/repo/issue/labels.tmpl +++ b/templates/repo/issue/labels.tmpl @@ -8,15 +8,11 @@ {{end}} - {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} - {{template "repo/issue/labels/label_new" .}} - {{end}} {{template "base/alert" .}} {{template "repo/issue/labels/label_list" .}} + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/label_edit_modal" .}} + {{end}} - -{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} - {{template "repo/issue/labels/edit_delete_label" .}} -{{end}} {{template "base/footer" .}} diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/label_edit_modal.tmpl similarity index 79% rename from templates/repo/issue/labels/edit_delete_label.tmpl rename to templates/repo/issue/labels/label_edit_modal.tmpl index fcf69217ea..f04d499737 100644 --- a/templates/repo/issue/labels/edit_delete_label.tmpl +++ b/templates/repo/issue/labels/label_edit_modal.tmpl @@ -1,22 +1,13 @@ -