Skip to content

Commit

Permalink
Display archived labels specially when listing labels (#26820)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
puni9869 and silverwind authored Sep 18, 2023
1 parent e97baed commit a50d9af
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 19 deletions.
3 changes: 2 additions & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ unpin = Unpin

artifacts = Artifacts

archived = Archived

concept_system_global = Global
concept_user_individual = Individual
concept_code_repository = Repository
Expand Down Expand Up @@ -317,7 +319,6 @@ filter_by_team_repositories = Filter by team repositories
feed_of = Feed of "%s"

show_archived = Archived
archived = Archived
show_both_archived_unarchived = Showing both archived and unarchived
show_only_archived = Showing only archived
show_only_unarchived = Showing only unarchived
Expand Down
5 changes: 4 additions & 1 deletion templates/repo/issue/filters.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
<div class="divider"></div>
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
<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>
<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}}
{{RenderLabel $.Context .}}
<p class="gt-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
</a>
{{end}}
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions templates/repo/issue/labels/label_archived.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{if .IsArchived}}
<span class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}">
{{ctx.Locale.Tr "archived"}}
</span>
{{end}}
30 changes: 15 additions & 15 deletions templates/repo/issue/labels/label_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
<li class="item">
<div class="label-title">
{{RenderLabel $.Context .}}
{{if not .ArchivedUnix.IsZero}}
<span class="gt-ml-3 gt-cursor-default gt-italic" data-tooltip-content="{{$.locale.Tr "repo.issues.label_archive_tooltip"}}">
{{$.locale.Tr "home.archived"}}
</span>
{{end}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
</div>
<div class="label-issues">
Expand All @@ -47,14 +42,17 @@
<a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a>
{{end}}
</div>
<div class="label-operation">
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
<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>
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
{{else if $.PageIsOrgSettingsLabels}}
<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>
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
{{end}}
<div class="label-operation gt-df">
{{template "repo/issue/labels/label_archived" .}}
<div class="gt-df gt-ml-auto">
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
<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>
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
{{else if $.PageIsOrgSettingsLabels}}
<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>
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a>
{{end}}
</div>
</div>
</li>
{{end}}
Expand All @@ -78,9 +76,11 @@
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
</div>
<div class="label-issues">
<a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a>
<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>
</div>
<div class="label-operation">
{{template "repo/issue/labels/label_archived" .}}
</div>
<div class="label-operation"></div>
</li>
{{end}}
{{end}}
Expand Down
3 changes: 2 additions & 1 deletion web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,8 @@ a.ui.ui.ui.basic.primary.label:hover {
}

.ui.basic.labels .label,
.ui.basic.label {
.ui.basic.label,
.ui.secondary.labels .ui.basic.label {
background: var(--color-button);
border-color: var(--color-light-border);
color: var(--color-text-light);
Expand Down
5 changes: 4 additions & 1 deletion web_src/css/repo/issue-label.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

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

.issue-label-list .item a {
Expand All @@ -42,3 +41,7 @@
.issue-label-list .item.org-label {
opacity: 0.7;
}

.label-operation .label {
height: fit-content;
}

0 comments on commit a50d9af

Please sign in to comment.