Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive labels UI enhancement #26511

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
28e59d8
Fix show archive method. Only change the date when it is newly archived.
puni9869 Aug 15, 2023
9b6c9fa
Put check on show-archived-labels-checkbox in js
puni9869 Aug 15, 2023
64cc5c2
Update templates/repo/issue/labels/label_list.tmpl
puni9869 Aug 15, 2023
aa8fc8e
Adding highlight and show hide to archive label
puni9869 Aug 15, 2023
d98c5f6
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 15, 2023
32d2eb4
Suggestion and feedback addressed
puni9869 Aug 15, 2023
a84c1da
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 15, 2023
7bf18d3
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 16, 2023
b2008a7
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 16, 2023
97dcf21
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 17, 2023
760903b
Merge branch 'go-gitea:main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 17, 2023
c7658b8
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 18, 2023
48ea8b0
Merge branch 'go-gitea:main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 19, 2023
809c4d0
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 21, 2023
0367cbb
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 22, 2023
49a7875
Design corrections
puni9869 Aug 22, 2023
8b524df
Added archived hint
puni9869 Aug 22, 2023
4d33abb
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 23, 2023
879fd87
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 23, 2023
62b7e75
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 23, 2023
1c522b4
Merge branch 'main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 25, 2023
dcfac08
Merge branch 'go-gitea:main' into punit/Archive-labels-ui-enhancement
puni9869 Aug 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions models/issues/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ func (l *Label) CalOpenIssues() {

// SetArchived set the label as archived
func (l *Label) SetArchived(isArchived bool) {
if isArchived && l.ArchivedUnix.IsZero() {
l.ArchivedUnix = timeutil.TimeStampNow()
} else {
if !isArchived {
l.ArchivedUnix = timeutil.TimeStamp(0)
} else if isArchived && l.ArchivedUnix.IsZero() {
// Only change the date when it is newly archived.
l.ArchivedUnix = timeutil.TimeStampNow()
}
}

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ issues.label_archive_tooltip= Archived labels are excluded from the label search
issues.label_exclusive_desc = Name the label <code>scope/item</code> to make it mutually exclusive with other <code>scope/</code> 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
issues.show_archived_labels = Show archived labels
issues.label_open_issues = %d open issues/pull requests
issues.label_edit = Edit
issues.label_delete = Delete
Expand Down
16 changes: 12 additions & 4 deletions templates/repo/issue/labels/label_list.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<h4 class="ui top attached header">
{{.locale.Tr "repo.issues.label_count" .NumLabels}}
<div class="ui right">
<h4 class="ui top attached header gt-df">
<span class="gt-f1">{{.locale.Tr "repo.issues.label_count" .NumLabels}}</span>
<label class="gt-f1" data-tooltip-content={{.locale.Tr "repo.issues.label_archive_tooltip"}}>
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
<input type="checkbox"
name="show_archived_labels"
class="show-archived-labels-checkbox"
>
{{.locale.Tr "repo.issues.show_archived_labels"}}
</label>
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved

<div class="ui right gt-f1">
<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui dropdown type jump item">
Expand Down Expand Up @@ -30,7 +38,7 @@

<ul class="issue-label-list">
{{range .Labels}}
<li class="item">
<li class="item" {{if gt .ArchivedUnix 0}}data-archived-label{{end}}>
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
<div class="label-title">
{{RenderLabel $.Context .}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
Expand Down
4 changes: 4 additions & 0 deletions web_src/css/repo/issue-label.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@
.issue-label-list .item.org-label {
opacity: 0.7;
}

.archived-label {
border-right: 4px solid var(--color-yellow-badge);
}
12 changes: 11 additions & 1 deletion web_src/js/features/repo-issue-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function initRepoIssueListCheckboxes() {
url,
action,
issueIDs,
elementId
elementId,
).then(() => {
window.location.reload();
}).catch((reason) => {
Expand Down Expand Up @@ -203,3 +203,13 @@ export function initRepoIssueList() {
initRepoIssueListAuthorDropdown();
initIssuePinSort();
}

export function initHighlightArchivedLabels() {
if (!document.querySelectorAll('.show-archived-labels-checkbox').length) return;
document.querySelector('.show-archived-labels-checkbox')
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
.addEventListener('input', () => {
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
for (const archivedLabel of document.querySelectorAll('[data-archived-label]')) {
archivedLabel.classList.toggle('archived-label');
}
});
}
5 changes: 3 additions & 2 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
initRepoIssueWipTitle,
initRepoPullRequestMergeInstruction,
initRepoPullRequestAllowMaintainerEdit,
initRepoPullRequestReview, initRepoIssueSidebarList
initRepoPullRequestReview, initRepoIssueSidebarList,
} from './features/repo-issue.js';
import {
initRepoEllipsisButton,
Expand Down Expand Up @@ -81,7 +81,7 @@ import {initRepositoryActionView} from './components/RepoActionView.vue';
import {initGlobalTooltips} from './modules/tippy.js';
import {initGiteaFomantic} from './modules/fomantic.js';
import {onDomReady} from './utils/dom.js';
import {initRepoIssueList} from './features/repo-issue-list.js';
import {initRepoIssueList, initHighlightArchivedLabels} from './features/repo-issue-list.js';
import {initCommonIssueListQuickGoto} from './features/common-issue-list.js';
import {initRepoDiffCommitBranchesAndTags} from './features/repo-diff-commit.js';

Expand Down Expand Up @@ -149,6 +149,7 @@ onDomReady(() => {
initRepoIssueContentHistory();
initRepoIssueDue();
initRepoIssueList();
initHighlightArchivedLabels();
initRepoIssueSidebarList();
initRepoIssueReferenceRepositorySearch();
initRepoIssueTimeTracking();
Expand Down