Skip to content

Commit d16d777

Browse files
committed
Convert issue list checkboxes to native
1 parent 3e8db31 commit d16d777

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

templates/repo/issue/list.tmpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
<div id="issue-filters" class="ui stackable grid">
3030
<div class="six wide column">
3131
{{if $.CanWriteIssuesOrPulls}}
32-
<div class="ui checkbox issue-checkbox-all gt-vm">
33-
<input type="checkbox" title="{{.locale.Tr "repo.issues.action_check_all"}}">
34-
</div>
32+
<input type="checkbox" class="issue-checkbox-all gt-vm gt-mr-4" title="{{.locale.Tr "repo.issues.action_check_all"}}">
3533
{{end}}
3634
{{template "repo/issue/openclose" .}}
3735
</div>

templates/shared/issuelist.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
{{$approvalCounts := .ApprovalCounts}}
33
{{range .Issues}}
44
<li class="item gt-df gt-py-3">
5-
<div class="issue-item-left gt-df">
5+
<div class="issue-item-left gt-df gt-items-start">
66
{{if $.CanWriteIssuesOrPulls}}
7-
<div class="ui checkbox issue-checkbox">
8-
<input type="checkbox" data-issue-id={{.ID}} title="{{$.locale.Tr "repo.issues.action_check"}} «{{.Title}}»">
9-
</div>
7+
<input type="checkbox" class="issue-checkbox gt-mt-2 gt-mr-4" data-issue-id={{.ID}} title="{{$.locale.Tr "repo.issues.action_check"}} «{{.Title}}»">
108
{{end}}
119
<div class="issue-item-icon">
1210
{{if .IsPull}}

web_src/css/helpers.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
.gt-relative { position: relative !important; }
2525
.gt-overflow-x-scroll { overflow-x: scroll !important; }
2626
.gt-cursor-default { cursor: default !important; }
27+
.gt-items-start { align-items: flex-start !important; }
2728

2829
.gt-mono {
2930
font-family: var(--fonts-monospace) !important;

web_src/js/features/common-issue.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import {updateIssuesMeta} from './repo-issue.js';
33
import {toggleElem} from '../utils/dom.js';
44

55
export function initCommonIssue() {
6-
const $issueSelectAllWrapper = $('.issue-checkbox-all');
7-
const $issueSelectAll = $('.issue-checkbox-all input');
8-
const $issueCheckboxes = $('.issue-checkbox input');
6+
const $issueSelectAll = $('.issue-checkbox-all');
7+
const $issueCheckboxes = $('.issue-checkbox');
98

109
const syncIssueSelectionState = () => {
1110
const $checked = $issueCheckboxes.filter(':checked');
@@ -23,7 +22,7 @@ export function initCommonIssue() {
2322
toggleElem($('#issue-filters'), !anyChecked);
2423
toggleElem($('#issue-actions'), anyChecked);
2524
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
26-
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper);
25+
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAll);
2726
};
2827

2928
$issueCheckboxes.on('change', syncIssueSelectionState);
@@ -38,7 +37,7 @@ export function initCommonIssue() {
3837
let action = this.getAttribute('data-action');
3938
let elementId = this.getAttribute('data-element-id');
4039
const url = this.getAttribute('data-url');
41-
const issueIDs = $('.issue-checkbox').children('input:checked').map((_, el) => {
40+
const issueIDs = $('.issue-checkbox:checked').map((_, el) => {
4241
return el.getAttribute('data-issue-id');
4342
}).get().join(',');
4443
if (elementId === '0' && url.slice(-9) === '/assignee') {
@@ -58,16 +57,9 @@ export function initCommonIssue() {
5857
// checkboxes stay checked after reload
5958
if (action === 'close' || action === 'open') {
6059
// uncheck all checkboxes
61-
$('.issue-checkbox input[type="checkbox"]').each((_, e) => { e.checked = false });
60+
$('.issue-checkbox').each((_, e) => { e.checked = false });
6261
}
6362
window.location.reload();
6463
});
6564
});
66-
67-
// NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay
68-
// checked after reload trigger checked event, if checkboxes are checked on load
69-
$('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
70-
e.checked = false;
71-
$(e).trigger('click');
72-
});
7365
}

0 commit comments

Comments
 (0)