1 |
85ad3d82
|
Assos Assos
|
(function ($) {
|
2 |
|
|
Drupal.behaviors.vbo = {
|
3 |
|
|
attach: function(context) {
|
4 |
|
|
$('.vbo-views-form', context).each(function() {
|
5 |
|
|
Drupal.vbo.initTableBehaviors(this);
|
6 |
|
|
Drupal.vbo.initGenericBehaviors(this);
|
7 |
|
|
});
|
8 |
|
|
}
|
9 |
|
|
}
|
10 |
|
|
|
11 |
|
|
Drupal.vbo = Drupal.vbo || {};
|
12 |
|
|
Drupal.vbo.initTableBehaviors = function(form) {
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
var selectAllMarkup = $('.vbo-table-select-all-markup', form);
|
16 |
|
|
if (selectAllMarkup.length) {
|
17 |
|
|
$('.views-table > tbody', form).prepend('<tr class="views-table-row-select-all even">></tr>');
|
18 |
|
|
var colspan = $('table th', form).length;
|
19 |
|
|
$('.views-table-row-select-all', form).html('<td colspan="' + colspan + '">' + selectAllMarkup.html() + '</td>');
|
20 |
|
|
|
21 |
|
|
$('.vbo-table-select-all-pages', form).click(function() {
|
22 |
|
|
Drupal.vbo.tableSelectAllPages(form);
|
23 |
|
|
return false;
|
24 |
|
|
});
|
25 |
|
|
$('.vbo-table-select-this-page', form).click(function() {
|
26 |
|
|
Drupal.vbo.tableSelectThisPage(form);
|
27 |
|
|
return false;
|
28 |
|
|
});
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
$('.vbo-table-select-all', form).show();
|
32 |
|
|
|
33 |
|
|
$('.vbo-table-select-all', form).click(function() {
|
34 |
|
|
var table = $(this).closest('table')[0];
|
35 |
|
|
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', table).attr('checked', this.checked);
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
if (this.checked) {
|
39 |
|
|
$('.views-table-row-select-all', table).show();
|
40 |
|
|
}
|
41 |
|
|
else {
|
42 |
|
|
$('.views-table-row-select-all', table).hide();
|
43 |
|
|
|
44 |
|
|
Drupal.vbo.tableSelectThisPage(form);
|
45 |
|
|
}
|
46 |
|
|
});
|
47 |
|
|
|
48 |
|
|
|
49 |
9df8b457
|
Assos Assos
|
if (Drupal.settings.vbo.row_clickable) {
|
50 |
|
|
$('.views-table tbody tr', form).click(function(event) {
|
51 |
|
|
if (event.target.tagName.toLowerCase() != 'input' && event.target.tagName.toLowerCase() != 'a') {
|
52 |
|
|
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', this).each(function() {
|
53 |
|
|
var checked = this.checked;
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
this.checked = !checked;
|
60 |
|
|
$(this).trigger('click');
|
61 |
|
|
this.checked = !checked;
|
62 |
|
|
});
|
63 |
|
|
}
|
64 |
|
|
});
|
65 |
|
|
}
|
66 |
85ad3d82
|
Assos Assos
|
}
|
67 |
|
|
|
68 |
|
|
Drupal.vbo.tableSelectAllPages = function(form) {
|
69 |
|
|
$('.vbo-table-this-page', form).hide();
|
70 |
|
|
$('.vbo-table-all-pages', form).show();
|
71 |
|
|
|
72 |
|
|
$('.select-all-rows', form).val('1');
|
73 |
|
|
}
|
74 |
|
|
Drupal.vbo.tableSelectThisPage = function(form) {
|
75 |
|
|
$('.vbo-table-all-pages', form).hide();
|
76 |
|
|
$('.vbo-table-this-page', form).show();
|
77 |
|
|
|
78 |
|
|
$('.select-all-rows', form).val('0');
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
Drupal.vbo.initGenericBehaviors = function(form) {
|
82 |
|
|
|
83 |
|
|
$('.vbo-select-all-markup', form).show();
|
84 |
|
|
|
85 |
|
|
$('.vbo-select-this-page', form).click(function() {
|
86 |
|
|
$('input[id^="edit-views-bulk-operations"]', form).attr('checked', this.checked);
|
87 |
|
|
$('.vbo-select-all-pages', form).attr('checked', false);
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
$('.vbo-table-select-all', form).attr('checked', this.checked);
|
91 |
|
|
});
|
92 |
|
|
$('.vbo-select-all-pages', form).click(function() {
|
93 |
|
|
$('input[id^="edit-views-bulk-operations"]', form).attr('checked', this.checked);
|
94 |
|
|
$('.vbo-select-this-page', form).attr('checked', false);
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
$('.vbo-table-select-all', form).attr('checked', this.checked);
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
$('.select-all-rows', form).val(this.checked);
|
101 |
|
|
});
|
102 |
|
|
|
103 |
|
|
$('.vbo-select', form).click(function() {
|
104 |
|
|
|
105 |
|
|
if (!this.checked) {
|
106 |
|
|
$('.vbo-select-this-page', form).attr('checked', false);
|
107 |
|
|
$('.vbo-select-all-pages', form).attr('checked', false);
|
108 |
|
|
|
109 |
|
|
$('.select-all-rows', form).val('0')
|
110 |
|
|
|
111 |
|
|
var table = $(this).closest('table')[0];
|
112 |
|
|
if (table) {
|
113 |
|
|
|
114 |
|
|
$('.vbo-table-select-all', table).attr('checked', false);
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
if ($('.vbo-table-select-this-page', table).length) {
|
118 |
|
|
$('.views-table-row-select-all', table).hide();
|
119 |
|
|
|
120 |
|
|
Drupal.vbo.tableSelectThisPage(form);
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
|
|
}
|
124 |
|
|
});
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
})(jQuery); |