Skip to content

Commit 5007055

Browse files
puni9869delvhGiteaBot
authored
Hide archived labels when filtering by labels on the issue list (#27115)
Followup #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 <img width="1360" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/d7efb2ef-5b2b-449d-83f0-d430a32ec432"> ### Issue page with label filter on archived label checkbox when not checked --> No archived label is there in list <img width="1249" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/ceea68ef-91f2-4693-910f-2e25e236bfc9"> ### Issue page with label filter on archived label checkbox when checked --> Show archived label in the list. <img width="710" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/2414d26b-2079-4c3c-bd9e-f2f5411bcabf"> ### Issue page with label filter on issue action menu on archived label checkbox when checked --> Show archived label in the list. <img width="409" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/259cac87-3e21-4778-99a2-a6a0b8c81178"> ### Applied the archived=true in Issue labels when archived checkbox is checked. <img width="984" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/657ce3db-c0ae-402e-b12d-3b580d3c2ed0"> --- Part of #25237 --------- Signed-off-by: puni9869 <punitinani1@hotmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 87aa552 commit 5007055

File tree

10 files changed

+237
-162
lines changed

10 files changed

+237
-162
lines changed

Diff for: options/locale/locale_en-US.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,8 @@ issues.label_description = Description
15191519
issues.label_color = Color
15201520
issues.label_exclusive = Exclusive
15211521
issues.label_archive = Archive Label
1522-
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.
1522+
issues.label_archived_filter = Show archived labels
1523+
issues.label_archive_tooltip = Archived labels are excluded by default from the suggestions when searching by label.
15231524
issues.label_exclusive_desc = Name the label <code>scope/item</code> to make it mutually exclusive with other <code>scope/</code> labels.
15241525
issues.label_exclusive_warning = Any conflicting scoped labels will be removed when editing the labels of an issue or pull request.
15251526
issues.label_count = %d labels

Diff for: routers/web/repo/issue.go

+5
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
442442
pager.AddParam(ctx, "project", "ProjectID")
443443
pager.AddParam(ctx, "assignee", "AssigneeID")
444444
pager.AddParam(ctx, "poster", "PosterID")
445+
446+
if ctx.FormBool("archived") {
447+
ctx.Data["ShowArchivedLabels"] = true
448+
pager.AddParam(ctx, "archived", "ShowArchivedLabels")
449+
}
445450
ctx.Data["Page"] = pager
446451
}
447452

Diff for: templates/repo/issue/filter_actions.tmpl

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<div class="ui secondary filter menu">
2+
{{if not .Repository.IsArchived}}
3+
<!-- Action Button -->
4+
{{if .IsShowClosed}}
5+
<button class="ui primary basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_open"}}</button>
6+
{{else}}
7+
<button class="ui red basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_close"}}</button>
8+
{{end}}
9+
{{if $.IsRepoAdmin}}
10+
<button class="ui red button issue-action"
11+
data-action="delete" data-url="{{$.RepoLink}}/issues/delete"
12+
data-action-delete-confirm="{{ctx.Locale.Tr "confirm_delete_selected"}}"
13+
>{{ctx.Locale.Tr "repo.issues.delete"}}</button>
14+
{{end}}
15+
<!-- Labels -->
16+
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
17+
<span class="text">
18+
{{ctx.Locale.Tr "repo.issues.action_label"}}
19+
</span>
20+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
21+
<div class="menu">
22+
<div class="item issue-action" data-action="clear" data-url="{{$.RepoLink}}/issues/labels">
23+
{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}
24+
</div>
25+
{{$previousExclusiveScope := "_no_scope"}}
26+
{{range .Labels}}
27+
{{$exclusiveScope := .ExclusiveScope}}
28+
{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
29+
<div class="divider"></div>
30+
{{end}}
31+
{{$previousExclusiveScope = $exclusiveScope}}
32+
<div class="item issue-action gt-df gt-items-start" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
33+
{{if SliceUtils.Contains $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}}
34+
{{if .IsArchived}}
35+
<i data-tooltip-content={{ctx.Locale.Tr "archived"}}>{{svg "octicon-info"}}</i>
36+
{{end}}
37+
</div>
38+
{{end}}
39+
</div>
40+
</div>
41+
42+
<!-- Milestone -->
43+
<div class="ui {{if not (or .OpenMilestones .ClosedMilestones)}}disabled{{end}} dropdown jump item">
44+
<span class="text">
45+
{{ctx.Locale.Tr "repo.issues.action_milestone"}}
46+
</span>
47+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
48+
<div class="menu">
49+
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/milestone">
50+
{{ctx.Locale.Tr "repo.issues.action_milestone_no_select"}}
51+
</div>
52+
{{if .OpenMilestones}}
53+
<div class="divider"></div>
54+
<div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div>
55+
{{range .OpenMilestones}}
56+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone">
57+
{{.Name}}
58+
</div>
59+
{{end}}
60+
{{end}}
61+
{{if .ClosedMilestones}}
62+
<div class="divider"></div>
63+
<div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div>
64+
{{range .ClosedMilestones}}
65+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone">
66+
{{.Name}}
67+
</div>
68+
{{end}}
69+
{{end}}
70+
</div>
71+
</div>
72+
73+
<!-- Projects -->
74+
<div class="ui{{if not (or .OpenProjects .ClosedProjects)}} disabled{{end}} dropdown jump item">
75+
<span class="text">
76+
{{ctx.Locale.Tr "repo.project_board"}}
77+
</span>
78+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
79+
<div class="menu">
80+
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
81+
{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}
82+
</div>
83+
{{if .OpenProjects}}
84+
<div class="divider"></div>
85+
<div class="header">
86+
{{ctx.Locale.Tr "repo.issues.new.open_projects"}}
87+
</div>
88+
{{range .OpenProjects}}
89+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
90+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
91+
</div>
92+
{{end}}
93+
{{end}}
94+
{{if .ClosedProjects}}
95+
<div class="divider"></div>
96+
<div class="header">
97+
{{ctx.Locale.Tr "repo.issues.new.closed_projects"}}
98+
</div>
99+
{{range .ClosedProjects}}
100+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
101+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
102+
</div>
103+
{{end}}
104+
{{end}}
105+
</div>
106+
</div>
107+
108+
<!-- Assignees -->
109+
<div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
110+
<span class="text">
111+
{{ctx.Locale.Tr "repo.issues.action_assignee"}}
112+
</span>
113+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
114+
<div class="menu">
115+
<div class="item issue-action" data-action="clear" data-url="{{$.Link}}/assignee">
116+
{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}
117+
</div>
118+
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/assignee">
119+
{{ctx.Locale.Tr "repo.issues.action_assignee_no_select"}}
120+
</div>
121+
{{range .Assignees}}
122+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee">
123+
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
124+
</div>
125+
{{end}}
126+
</div>
127+
</div>
128+
{{end}}
129+
</div>
130+

0 commit comments

Comments
 (0)