Skip to content

Commit a50d9af

Browse files
puni9869silverwind
andauthored
Display archived labels specially when listing labels (#26820)
Follow up #26741 Changes: Added archived label for org labels and added into issue filter list. Part of #25237 --------- Signed-off-by: puni9869 <[email protected]> Co-authored-by: silverwind <[email protected]>
1 parent e97baed commit a50d9af

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

options/locale/locale_en-US.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ unpin = Unpin
123123

124124
artifacts = Artifacts
125125

126+
archived = Archived
127+
126128
concept_system_global = Global
127129
concept_user_individual = Individual
128130
concept_code_repository = Repository
@@ -317,7 +319,6 @@ filter_by_team_repositories = Filter by team repositories
317319
feed_of = Feed of "%s"
318320

319321
show_archived = Archived
320-
archived = Archived
321322
show_both_archived_unarchived = Showing both archived and unarchived
322323
show_only_archived = Showing only archived
323324
show_only_unarchived = Showing only unarchived

templates/repo/issue/filters.tmpl

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
<div class="divider"></div>
3030
{{end}}
3131
{{$previousExclusiveScope = $exclusiveScope}}
32-
<a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}}</a>
32+
<a class="item label-filter-item gt-df gt-ac" {{if .IsArchived}}data-is-archived{{end}} href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}}
33+
{{RenderLabel $.Context .}}
34+
<p class="gt-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
35+
</a>
3336
{{end}}
3437
</div>
3538
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{if .IsArchived}}
2+
<span class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}">
3+
{{ctx.Locale.Tr "archived"}}
4+
</span>
5+
{{end}}

templates/repo/issue/labels/label_list.tmpl

+15-15
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
<li class="item">
3434
<div class="label-title">
3535
{{RenderLabel $.Context .}}
36-
{{if not .ArchivedUnix.IsZero}}
37-
<span class="gt-ml-3 gt-cursor-default gt-italic" data-tooltip-content="{{$.locale.Tr "repo.issues.label_archive_tooltip"}}">
38-
{{$.locale.Tr "home.archived"}}
39-
</span>
40-
{{end}}
4136
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
4237
</div>
4338
<div class="label-issues">
@@ -47,14 +42,17 @@
4742
<a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a>
4843
{{end}}
4944
</div>
50-
<div class="label-operation">
51-
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
52-
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a>
53-
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
54-
{{else if $.PageIsOrgSettingsLabels}}
55-
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a>
56-
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
57-
{{end}}
45+
<div class="label-operation gt-df">
46+
{{template "repo/issue/labels/label_archived" .}}
47+
<div class="gt-df gt-ml-auto">
48+
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
49+
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a>
50+
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
51+
{{else if $.PageIsOrgSettingsLabels}}
52+
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a>
53+
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
54+
{{end}}
55+
</div>
5856
</div>
5957
</li>
6058
{{end}}
@@ -78,9 +76,11 @@
7876
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
7977
</div>
8078
<div class="label-issues">
81-
<a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a>
79+
<a class="open-issues" {{if .IsArchived}}data-is-archived{{end}} href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a>
80+
</div>
81+
<div class="label-operation">
82+
{{template "repo/issue/labels/label_archived" .}}
8283
</div>
83-
<div class="label-operation"></div>
8484
</li>
8585
{{end}}
8686
{{end}}

web_src/css/base.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,8 @@ a.ui.ui.ui.basic.primary.label:hover {
19691969
}
19701970

19711971
.ui.basic.labels .label,
1972-
.ui.basic.label {
1972+
.ui.basic.label,
1973+
.ui.secondary.labels .ui.basic.label {
19731974
background: var(--color-button);
19741975
border-color: var(--color-light-border);
19751976
color: var(--color-text-light);

web_src/css/repo/issue-label.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
.issue-label-list .item .label-operation {
3232
width: 33%;
33-
text-align: right;
3433
}
3534

3635
.issue-label-list .item a {
@@ -42,3 +41,7 @@
4241
.issue-label-list .item.org-label {
4342
opacity: 0.7;
4443
}
44+
45+
.label-operation .label {
46+
height: fit-content;
47+
}

0 commit comments

Comments
 (0)