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

Adds a checkbox to select all issues/PRs #20177

Merged
merged 20 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 4 additions & 0 deletions templates/repo/issue/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<div class="ui divider"></div>
<div id="issue-filters" class="ui stackable grid">
<div class="six wide column">
<div class="ui checkbox issue-checkbox-all">
<input type="checkbox"></input>
<label></label>
</div>
tyroneyeh marked this conversation as resolved.
Show resolved Hide resolved
{{template "repo/issue/openclose" .}}
</div>
<div class="ten wide right aligned column">
Expand Down
25 changes: 22 additions & 3 deletions web_src/js/features/common-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,33 @@ import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js';

export function initCommonIssue() {
$('.issue-checkbox').on('click', () => {
const numChecked = $('.issue-checkbox').children('input:checked').length;
if (numChecked > 0) {
$('.issue-checkbox,.issue-checkbox-all').on('click', (e) => {
tyroneyeh marked this conversation as resolved.
Show resolved Hide resolved
const issuecheckbox = $('.issue-checkbox input');
if (e.currentTarget.className.includes('issue-checkbox-all')) {
if ($('.issue-checkbox-all input').prop('checked')) {
const selected = $('.issue-checkbox input:checked');
$('.issue-checkbox input:not(:checked)').prop('checked', 1);
selected.prop('checked', 0);
} else {
$('.issue-checkbox input:checked').prop('checked', 0);
}
}
if (e.shiftKey && window.config.checkboxfirst !== undefined) {
for (let i = window.config.checkboxfirst + 1, j = issuecheckbox.index($(e.currentTarget).find('input')); i < j; i++) {
issuecheckbox[i].checked = 1;
}
delete window.config.checkboxfirst;
} else {
window.config.checkboxfirst = issuecheckbox.index($(e.currentTarget).find('input'));
}
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
if (issuecheckbox.is(':checked')) {
$('#issue-filters').addClass('hide');
$('#issue-actions').removeClass('hide');
$('#issue-actions .six').prepend($('.issue-checkbox-all'));
} else {
$('#issue-filters').removeClass('hide');
$('#issue-actions').addClass('hide');
$('#issue-filters .six').prepend($('.issue-checkbox-all'));
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
}
});

Expand Down