|
|
@ -3,9 +3,8 @@ import {updateIssuesMeta} from './repo-issue.js';
|
|
|
|
import {toggleElem} from '../utils/dom.js';
|
|
|
|
import {toggleElem} from '../utils/dom.js';
|
|
|
|
|
|
|
|
|
|
|
|
export function initCommonIssue() {
|
|
|
|
export function initCommonIssue() {
|
|
|
|
const $issueSelectAllWrapper = $('.issue-checkbox-all');
|
|
|
|
const $issueSelectAll = $('.issue-checkbox-all');
|
|
|
|
const $issueSelectAll = $('.issue-checkbox-all input');
|
|
|
|
const $issueCheckboxes = $('.issue-checkbox');
|
|
|
|
const $issueCheckboxes = $('.issue-checkbox input');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const syncIssueSelectionState = () => {
|
|
|
|
const syncIssueSelectionState = () => {
|
|
|
|
const $checked = $issueCheckboxes.filter(':checked');
|
|
|
|
const $checked = $issueCheckboxes.filter(':checked');
|
|
|
@ -23,7 +22,7 @@ export function initCommonIssue() {
|
|
|
|
toggleElem($('#issue-filters'), !anyChecked);
|
|
|
|
toggleElem($('#issue-filters'), !anyChecked);
|
|
|
|
toggleElem($('#issue-actions'), anyChecked);
|
|
|
|
toggleElem($('#issue-actions'), anyChecked);
|
|
|
|
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
|
|
|
|
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
|
|
|
|
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper);
|
|
|
|
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAll);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$issueCheckboxes.on('change', syncIssueSelectionState);
|
|
|
|
$issueCheckboxes.on('change', syncIssueSelectionState);
|
|
|
@ -38,7 +37,7 @@ export function initCommonIssue() {
|
|
|
|
let action = this.getAttribute('data-action');
|
|
|
|
let action = this.getAttribute('data-action');
|
|
|
|
let elementId = this.getAttribute('data-element-id');
|
|
|
|
let elementId = this.getAttribute('data-element-id');
|
|
|
|
const url = this.getAttribute('data-url');
|
|
|
|
const url = this.getAttribute('data-url');
|
|
|
|
const issueIDs = $('.issue-checkbox').children('input:checked').map((_, el) => {
|
|
|
|
const issueIDs = $('.issue-checkbox:checked').map((_, el) => {
|
|
|
|
return el.getAttribute('data-issue-id');
|
|
|
|
return el.getAttribute('data-issue-id');
|
|
|
|
}).get().join(',');
|
|
|
|
}).get().join(',');
|
|
|
|
if (elementId === '0' && url.slice(-9) === '/assignee') {
|
|
|
|
if (elementId === '0' && url.slice(-9) === '/assignee') {
|
|
|
@ -54,20 +53,7 @@ export function initCommonIssue() {
|
|
|
|
issueIDs,
|
|
|
|
issueIDs,
|
|
|
|
elementId
|
|
|
|
elementId
|
|
|
|
).then(() => {
|
|
|
|
).then(() => {
|
|
|
|
// NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the
|
|
|
|
|
|
|
|
// checkboxes stay checked after reload
|
|
|
|
|
|
|
|
if (action === 'close' || action === 'open') {
|
|
|
|
|
|
|
|
// uncheck all checkboxes
|
|
|
|
|
|
|
|
$('.issue-checkbox input[type="checkbox"]').each((_, e) => { e.checked = false });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
window.location.reload();
|
|
|
|
window.location.reload();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay
|
|
|
|
|
|
|
|
// checked after reload trigger checked event, if checkboxes are checked on load
|
|
|
|
|
|
|
|
$('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
|
|
|
|
|
|
|
|
e.checked = false;
|
|
|
|
|
|
|
|
$(e).trigger('click');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|