From 50070550a8798dba2f1758d39923f0f4ef09acb5 Mon Sep 17 00:00:00 2001
From: puni9869 <80308335+puni9869@users.noreply.github.com>
Date: Sun, 1 Oct 2023 18:34:39 +0530
Subject: [PATCH] Hide archived labels when filtering by labels on the issue
list (#27115)
Followup https://github.com/go-gitea/gitea/pull/26820
## Archived labels UI for issue filter and issue filter actions for
issues/pull request pages.
Changed:
* Enhanced the Issue filter and Issue filter actions UI page to
seamlessly incorporate a list of archived labels.
* Pagination functionality is same as before. If archived label checkbox
is checked then we are adding a query string`archived=true` in the url
to save the state of page.
* Issue filter actions menu is separated into different template.
* Adding the archived flag in issue url labels.
* Pull Request page is also work the same.
Outsourced:
* Defer the implementation of specialized handling for archived labels
to upcoming pull requests. This step will be undertaken subsequent to
the successful merge of this pull request.
Screenshots
### Issue page
### Issue page with label filter on archived label checkbox when not
checked --> No archived label is there in list
### Issue page with label filter on archived label checkbox when checked
--> Show archived label in the list.
### Issue page with label filter on issue action menu on archived label
checkbox when checked --> Show archived label in the list.
### Applied the archived=true in Issue labels when archived checkbox is
checked.
---
Part of https://github.com/go-gitea/gitea/issues/25237
---------
Signed-off-by: puni9869
Co-authored-by: delvh
Co-authored-by: Giteabot
---
options/locale/locale_en-US.ini | 3 +-
routers/web/repo/issue.go | 5 +
templates/repo/issue/filter_actions.tmpl | 130 +++++++++++++++++++++++
templates/repo/issue/filters.tmpl | 79 +++++++++-----
templates/repo/issue/list.tmpl | 127 +---------------------
templates/repo/issue/openclose.tmpl | 4 +-
templates/shared/issuelist.tmpl | 2 +-
web_src/css/repo.css | 6 +-
web_src/css/repo/issue-list.css | 8 ++
web_src/js/features/repo-issue-list.js | 35 +++++-
10 files changed, 237 insertions(+), 162 deletions(-)
create mode 100644 templates/repo/issue/filter_actions.tmpl
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 8667e77a8..3c8c32256 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1519,7 +1519,8 @@ issues.label_description = Description
issues.label_color = Color
issues.label_exclusive = Exclusive
issues.label_archive = Archive Label
-issues.label_archive_tooltip= Archived labels are excluded from the label search when applying labels to an issue. Existing labels on issues remain unaffected, allowing you to retire obsolete labels without losing information.
+issues.label_archived_filter = Show archived labels
+issues.label_archive_tooltip = Archived labels are excluded by default from the suggestions when searching by label.
issues.label_exclusive_desc = Name the label scope/item to make it mutually exclusive with other scope/ labels.
issues.label_exclusive_warning = Any conflicting scoped labels will be removed when editing the labels of an issue or pull request.
issues.label_count = %d labels
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 090d23301..6394ee419 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -442,6 +442,11 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
pager.AddParam(ctx, "project", "ProjectID")
pager.AddParam(ctx, "assignee", "AssigneeID")
pager.AddParam(ctx, "poster", "PosterID")
+
+ if ctx.FormBool("archived") {
+ ctx.Data["ShowArchivedLabels"] = true
+ pager.AddParam(ctx, "archived", "ShowArchivedLabels")
+ }
ctx.Data["Page"] = pager
}
diff --git a/templates/repo/issue/filter_actions.tmpl b/templates/repo/issue/filter_actions.tmpl
new file mode 100644
index 000000000..f84a99ff7
--- /dev/null
+++ b/templates/repo/issue/filter_actions.tmpl
@@ -0,0 +1,130 @@
+