diff --git a/templates/repo/issue/filter_actions.tmpl b/templates/repo/issue/filter_actions.tmpl
index f84a99ff7..a2296f659 100644
--- a/templates/repo/issue/filter_actions.tmpl
+++ b/templates/repo/issue/filter_actions.tmpl
@@ -29,11 +29,9 @@
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
-
+
{{if SliceUtils.Contains $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}}
- {{if .IsArchived}}
- {{svg "octicon-info"}}
- {{end}}
+ {{template "repo/issue/labels/label_archived" .}}
{{end}}
diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl
index 1599f2deb..d24dac46e 100644
--- a/templates/repo/issue/labels/labels_selector_field.tmpl
+++ b/templates/repo/issue/labels/labels_selector_field.tmpl
@@ -21,8 +21,10 @@
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
- {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}}
- {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
+ {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}}
+ {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
+ {{template "repo/issue/labels/label_archived" .}}
+
{{end}}
{{$previousExclusiveScope = "_no_scope"}}
@@ -32,8 +34,10 @@
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
- {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}}
- {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
+ {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}}
+ {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
+ {{template "repo/issue/labels/label_archived" .}}
+
{{end}}
{{else}}
{{ctx.Locale.Tr "repo.issues.new.no_items"}}
diff --git a/web_src/css/repo/issue-label.css b/web_src/css/repo/issue-label.css
index 1f83e81d9..9b4b144a0 100644
--- a/web_src/css/repo/issue-label.css
+++ b/web_src/css/repo/issue-label.css
@@ -45,3 +45,8 @@
.label-operation .label {
height: fit-content;
}
+
+.archived-label-hint {
+ float: right;
+ margin: -12px;
+}
diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js
index a9a8628ba..ca20cfbe3 100644
--- a/web_src/js/features/repo-issue-list.js
+++ b/web_src/js/features/repo-issue-list.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js';
-import {toggleElem} from '../utils/dom.js';
+import {toggleElem, hideElem} from '../utils/dom.js';
import {htmlEscape} from 'escape-goat';
import {confirmModal} from './comp/ConfirmModal.js';
import {showErrorToast} from '../modules/toast.js';
@@ -194,6 +194,10 @@ function initArchivedLabelFilter() {
const url = new URL(window.location.href);
const archivedLabels = document.querySelectorAll('[data-is-archived]');
+ if (!archivedLabels.length) {
+ hideElem('.archived-label-filter');
+ return;
+ }
const selectedLabels = (url.searchParams.get('labels') || '')
.split(',')
.map((id) => id < 0 ? `${~id + 1}` : id); // selectedLabels contains -ve ids, which are excluded so convert any -ve value id to +ve
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index 4f4103bb2..2cc0730af 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -680,3 +680,16 @@ export function initIssueTemplateCommentEditors($commentForm) {
initCombo($(el));
}
}
+
+// This function used to show and hide archived label on issue/pr
+// page in the sidebar where we select the labels
+// If we have any archived label tagged to issue and pr. We will show that
+// archived label with checked classed otherwise we will hide it
+// with the help of this function.
+// This function runs globally.
+export function initArchivedLabelHandler() {
+ if (!document.querySelector('.archived-label-hint')) return;
+ for (const label of document.querySelectorAll('[data-is-archived]')) {
+ toggleElem(label, label.classList.contains('checked'));
+ }
+}
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 7ae4b0c0c..471361850 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -31,7 +31,7 @@ import {
initRepoIssueWipTitle,
initRepoPullRequestMergeInstruction,
initRepoPullRequestAllowMaintainerEdit,
- initRepoPullRequestReview, initRepoIssueSidebarList
+ initRepoPullRequestReview, initRepoIssueSidebarList, initArchivedLabelHandler,
} from './features/repo-issue.js';
import {
initRepoEllipsisButton,
@@ -152,6 +152,7 @@ onDomReady(() => {
initRepoIssueDue();
initRepoIssueList();
initRepoIssueSidebarList();
+ initArchivedLabelHandler();
initRepoIssueReferenceRepositorySearch();
initRepoIssueTimeTracking();
initRepoIssueWipTitle();