backoffice: require a second explicit click to select all items (#38057)
This commit is contained in:
parent
6a549fb053
commit
c10c8b76c7
|
@ -91,9 +91,9 @@ class FormDefUI(object):
|
|||
else:
|
||||
r += htmltext('<th></th>') # lock
|
||||
if include_checkboxes:
|
||||
r += htmltext('<th class="select"><input type="checkbox" name="select[]" value="_all"/>')
|
||||
r += htmltext(' <span id="info-all-rows">%s</span></th>') % _(
|
||||
'Do note the selected action will run on all pages when this is checked.')
|
||||
r += htmltext('<th class="select"><input type="checkbox" id="top-select"/>')
|
||||
r += htmltext(' <span id="info-all-rows"><label><input type="checkbox" name="select[]" value="_all"/> %s</label></span></th>') % _(
|
||||
'Run selected action on all pages')
|
||||
for f in fields:
|
||||
field_sort_key = None
|
||||
if getattr(f, 'fake', False):
|
||||
|
|
|
@ -45,21 +45,27 @@ function prepare_row_links() {
|
|||
$(this).parents('tr').removeClass('checked');
|
||||
}
|
||||
});
|
||||
if ($('#page-links .pages a').length < 2) {
|
||||
$('#info-all-rows').hide();
|
||||
}
|
||||
$('#listing input[type=checkbox]').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
if ($(this).is('[value=_all]')) {
|
||||
if ($(this).is('#top-select')) {
|
||||
$(this).parents('table').find('tbody td.select input').prop('checked', true);
|
||||
$(this).parents('table').find('tbody tr').addClass('checked');
|
||||
} else {
|
||||
$(this).parents('tr').addClass('checked');
|
||||
}
|
||||
} else {
|
||||
if ($(this).is('[value=_all]')) {
|
||||
if ($(this).is('#top-select')) {
|
||||
$(this).parents('table').find('tbody td.select input').prop('checked', false);
|
||||
$(this).parents('table').find('tbody tr').removeClass('checked');
|
||||
} else if ($(this).is('[value=_all]')) {
|
||||
// do nothing particular when unchecking "all"
|
||||
} else {
|
||||
$(this).parents('tr').removeClass('checked');
|
||||
$('#listing input[type=checkbox][value=_all]').prop('checked', false);
|
||||
$('#listing input[type=checkbox]#top-select').prop('checked', false);
|
||||
}
|
||||
}
|
||||
if ($('#listing tbody input[type=checkbox]:checked').length == 0) {
|
||||
|
|
Loading…
Reference in New Issue