Refactor sidebar label selector (#32460)
Introduce `issueSidebarLabelsData` to handle all sidebar labels related data.
This commit is contained in:
parent
b55a31eb6a
commit
58c634b854
22 changed files with 276 additions and 233 deletions
|
@ -98,6 +98,7 @@ export function initRepoIssueSidebarList() {
|
|||
});
|
||||
});
|
||||
|
||||
// FIXME: it is wrong place to init ".ui.dropdown.label-filter"
|
||||
$('.menu .ui.dropdown.label-filter').on('keydown', (e) => {
|
||||
if (e.altKey && e.key === 'Enter') {
|
||||
const selectedItem = document.querySelector('.menu .ui.dropdown.label-filter .menu .item.selected');
|
||||
|
@ -106,7 +107,6 @@ export function initRepoIssueSidebarList() {
|
|||
}
|
||||
}
|
||||
});
|
||||
$('.ui.dropdown.label-filter, .ui.dropdown.select-label').dropdown('setting', {'hideDividers': 'empty'}).dropdown('refreshItems');
|
||||
}
|
||||
|
||||
export function initRepoIssueCommentDelete() {
|
||||
|
@ -652,19 +652,6 @@ function initIssueTemplateCommentEditors($commentForm) {
|
|||
}
|
||||
}
|
||||
|
||||
// This function used to show and hide archived label on issue/pr
|
||||
// page in the sidebar where we select the labels
|
||||
// If we have any archived label tagged to issue and pr. We will show that
|
||||
// archived label with checked classed otherwise we will hide it
|
||||
// with the help of this function.
|
||||
// This function runs globally.
|
||||
export function initArchivedLabelHandler() {
|
||||
if (!document.querySelector('.archived-label-hint')) return;
|
||||
for (const label of document.querySelectorAll('[data-is-archived]')) {
|
||||
toggleElem(label, label.classList.contains('checked'));
|
||||
}
|
||||
}
|
||||
|
||||
export function initRepoCommentFormAndSidebar() {
|
||||
const $commentForm = $('.comment.form');
|
||||
if (!$commentForm.length) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue