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

Hide archived labels by default from the suggestions when assigning labels for an issue #27451

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e25b7fc
Adding archive label functionality for label selector in issue detail…
puni9869 Oct 5, 2023
2fa6357
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 5, 2023
8db7e06
Reverting the linted code
puni9869 Oct 5, 2023
f0be3f7
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 5, 2023
0560ad0
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 5, 2023
90116d8
Hiding the labels when there is no archived label is tagged in issue …
puni9869 Oct 5, 2023
33b01af
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 5, 2023
1a55eae
using archived label template
puni9869 Oct 5, 2023
62cbe2b
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 6, 2023
1f592c3
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 6, 2023
009f923
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 7, 2023
107accb
Style correction
puni9869 Oct 7, 2023
5e855a5
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 7, 2023
d281bbe
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 7, 2023
e9062ba
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 8, 2023
2da88f7
Indentation for anchor tag
puni9869 Oct 9, 2023
a375801
Typo
puni9869 Oct 9, 2023
a43dd00
Similar ui for archived hint.
puni9869 Oct 9, 2023
6e70661
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 9, 2023
9d8ed4b
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 9, 2023
7101b32
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 10, 2023
c4db3ad
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 11, 2023
e3bffa7
Update web_src/js/features/repo-issue.js
silverwind Oct 13, 2023
b17d36a
Update web_src/js/features/repo-issue.js
silverwind Oct 13, 2023
013008e
Update web_src/js/features/repo-issue.js
silverwind Oct 13, 2023
c3f1a40
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
puni9869 Oct 13, 2023
f7813de
Adding comments
puni9869 Oct 15, 2023
f52da8f
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
GiteaBot Oct 17, 2023
7b84f89
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
GiteaBot Oct 17, 2023
12411af
Merge branch 'main' into punit/update-pr-label-filter-archived-functi…
GiteaBot Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions templates/repo/issue/labels/labels_selector_field.tmpl
Expand Up @@ -21,8 +21,10 @@
<div class="divider"></div>
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a>
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
<p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p>
</a>
{{end}}
<div class="divider"></div>
{{$previousExclusiveScope = "_no_scope"}}
Expand All @@ -32,8 +34,10 @@
<div class="divider"></div>
{{end}}
{{$previousExclusiveScope = $exclusiveScope}}
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a>
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}}
{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}
<p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p>
</a>
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
{{end}}
{{else}}
<div class="disabled item">{{ctx.Locale.Tr "repo.issues.new.no_items"}}</div>
Expand Down
5 changes: 5 additions & 0 deletions web_src/css/repo/issue-label.css
Expand Up @@ -45,3 +45,8 @@
.label-operation .label {
height: fit-content;
}

.archived-label-hint {
float: right;
margin-left: 1rem;
}
6 changes: 5 additions & 1 deletion 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';
Expand Down Expand Up @@ -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'));
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
delvh marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
11 changes: 11 additions & 0 deletions web_src/js/features/repo-issue.js
Expand Up @@ -680,3 +680,14 @@ export function initIssueTemplateCommentEditors($commentForm) {
initCombo($(el));
}
}

export function initArchivedLabelHandler() {
puni9869 marked this conversation as resolved.
Show resolved Hide resolved
const archivedLabelEl = document.querySelector('.archived-label-hint');
if (!archivedLabelEl) {
return;
}
silverwind marked this conversation as resolved.
Show resolved Hide resolved
const archivedLabels = document.querySelectorAll('[data-is-archived]');
for (const label of archivedLabels) {
silverwind marked this conversation as resolved.
Show resolved Hide resolved
toggleElem(label, label.classList.contains('checked'));
}
}
3 changes: 2 additions & 1 deletion web_src/js/index.js
Expand Up @@ -31,7 +31,7 @@ import {
initRepoIssueWipTitle,
initRepoPullRequestMergeInstruction,
initRepoPullRequestAllowMaintainerEdit,
initRepoPullRequestReview, initRepoIssueSidebarList
initRepoPullRequestReview, initRepoIssueSidebarList, initArchivedLabelHandler,
} from './features/repo-issue.js';
import {
initRepoEllipsisButton,
Expand Down Expand Up @@ -152,6 +152,7 @@ onDomReady(() => {
initRepoIssueDue();
initRepoIssueList();
initRepoIssueSidebarList();
initArchivedLabelHandler();
initRepoIssueReferenceRepositorySearch();
initRepoIssueTimeTracking();
initRepoIssueWipTitle();
Expand Down