Révision b8087750
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views_bulk_operations/js/views_bulk_operations.js | ||
---|---|---|
38 | 38 |
|
39 | 39 |
$('.vbo-table-select-all', form).show(); |
40 | 40 |
// This is the "select all" checkbox in (each) table header. |
41 |
$('.vbo-table-select-all', form).click(function() { |
|
42 |
var table = $(this).closest('table')[0]; |
|
43 |
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', table).prop('checked', this.checked);
|
|
41 |
$('input.vbo-table-select-all', form).click(function() {
|
|
42 |
var table = $(this).closest('table:not(.sticky-header)')[0];
|
|
43 |
$('.vbo-select:not(:disabled)', table).prop('checked', this.checked);
|
|
44 | 44 |
Drupal.vbo.toggleButtonsState(form); |
45 | 45 |
|
46 | 46 |
// Toggle the visibility of the "select all" row (if any). |
... | ... | |
57 | 57 |
// Set up the ability to click anywhere on the row to select it. |
58 | 58 |
if (Drupal.settings.vbo.row_clickable) { |
59 | 59 |
$('.views-table tbody tr', form).click(function(event) { |
60 |
if (event.target.tagName.toLowerCase() != 'input' && event.target.tagName.toLowerCase() != 'a') { |
|
61 |
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', this).each(function() { |
|
62 |
var checked = this.checked; |
|
63 |
// trigger() toggles the checkmark *after* the event is set, |
|
64 |
// whereas manually clicking the checkbox toggles it *beforehand*. |
|
65 |
// that's why we manually set the checkmark first, then trigger the |
|
66 |
// event (so that listeners get notified), then re-set the checkmark |
|
67 |
// which the trigger will have toggled. yuck! |
|
68 |
this.checked = !checked; |
|
69 |
$(this).trigger('click'); |
|
70 |
this.checked = !checked; |
|
60 |
var tagName = event.target.tagName.toLowerCase(); |
|
61 |
if (tagName != 'input' && tagName != 'a' && tagName != 'label') { |
|
62 |
$('.vbo-select:not(:disabled)', this).each(function() { |
|
63 |
// Always return true for radios, you cannot de-select a radio by clicking on it, |
|
64 |
// it should be the same when clicking on a row. |
|
65 |
this.checked = $(this).is(':radio') ? true : !this.checked; |
|
66 |
$(this).trigger('change'); |
|
71 | 67 |
}); |
72 | 68 |
} |
73 | 69 |
}); |
... | ... | |
92 | 88 |
$('.vbo-select-all-markup', form).show(); |
93 | 89 |
|
94 | 90 |
$('.vbo-select-this-page', form).click(function() { |
95 |
$('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked);
|
|
91 |
$('.vbo-select', form).prop('checked', this.checked);
|
|
96 | 92 |
Drupal.vbo.toggleButtonsState(form); |
97 | 93 |
$('.vbo-select-all-pages', form).prop('checked', false); |
98 | 94 |
|
... | ... | |
100 | 96 |
$('.vbo-table-select-all', form).prop('checked', this.checked); |
101 | 97 |
}); |
102 | 98 |
$('.vbo-select-all-pages', form).click(function() { |
103 |
$('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked);
|
|
99 |
$('.vbo-select', form).prop('checked', this.checked);
|
|
104 | 100 |
Drupal.vbo.toggleButtonsState(form); |
105 | 101 |
$('.vbo-select-this-page', form).prop('checked', false); |
106 | 102 |
|
... | ... | |
117 | 113 |
Drupal.vbo.toggleButtonsState(form); |
118 | 114 |
}); |
119 | 115 |
|
120 |
$('.vbo-select', form).click(function() { |
|
116 |
// Handle a "change" event originating either from a row click or an actual checkbox click. |
|
117 |
$('.vbo-select', form).change(function() { |
|
121 | 118 |
// If a checkbox was deselected, uncheck any "select all" checkboxes. |
122 | 119 |
if (!this.checked) { |
123 | 120 |
$('.vbo-select-this-page', form).prop('checked', false); |
... | ... | |
147 | 144 |
// If no rows are checked, disable any form submit actions. |
148 | 145 |
var selectbox = $('select[name="operation"]', form); |
149 | 146 |
var checkedCheckboxes = $('.vbo-select:checked', form); |
150 |
var buttons = $('[id^="edit-select"] input[type="submit"]', form); |
|
147 |
// The .vbo-prevent-toggle CSS class is added to buttons to prevent toggling |
|
148 |
// between disabled and enabled. For example the case of an 'add' button. |
|
149 |
var buttons = $('[id^="edit-select"] [type="submit"]:not(.vbo-prevent-toggle)', form); |
|
151 | 150 |
|
152 | 151 |
if (selectbox.length) { |
153 | 152 |
var has_selection = checkedCheckboxes.length && selectbox.val() !== '0'; |
Formats disponibles : Unified diff
Weekly update of contrib modules