Show More
@@ -124,14 +124,25 b' define([' | |||||
124 | $('.delete-button').click($.proxy(this.delete_selected, this)); |
|
124 | $('.delete-button').click($.proxy(this.delete_selected, this)); | |
125 |
|
125 | |||
126 | // Bind events for selection menu buttons. |
|
126 | // Bind events for selection menu buttons. | |
127 |
$('#selector-menu').click(function(event){ |
|
127 | $('#selector-menu').click(function (event) { | |
128 | $('#select-all').change(function(){that.select($(this).is(':checked') ? 'select-all' : 'select-none')}); |
|
128 | that.select($(event.target).attr('id')); | |
|
129 | }); | |||
|
130 | var select_all = $('#select-all'); | |||
|
131 | select_all.change(function () { | |||
|
132 | if (!select_all.prop('checked') || select_all.data('indeterminate')) { | |||
|
133 | that.select('select-none'); | |||
|
134 | } else { | |||
|
135 | that.select('select-all'); | |||
|
136 | } | |||
|
137 | }); | |||
129 | $('#button-select-all').click(function(e) { |
|
138 | $('#button-select-all').click(function (e) { | |
130 | // toggle checkbox if the click doesn't come from the checkbox already |
|
139 | // toggle checkbox if the click doesn't come from the checkbox already | |
131 | if (!$(e.target).is('input[type=checkbox]')) { |
|
140 | if (!$(e.target).is('input[type=checkbox]')) { | |
132 | var checkbox = $('#select-all'); |
|
141 | if (select_all.prop('checked') || select_all.data('indeterminate')) { | |
133 | checkbox.prop('checked', !checkbox.prop('checked')); |
|
142 | that.select('select-none'); | |
134 | that.select(checkbox.prop('checked') ? 'select-all' : 'select-none'); |
|
143 | } else { | |
|
144 | that.select('select-all'); | |||
|
145 | } | |||
135 | } |
|
146 | } | |
136 | }); |
|
147 | }); | |
137 | } |
|
148 | } | |
@@ -481,15 +492,20 b' define([' | |||||
481 | total++; |
|
492 | total++; | |
482 | } |
|
493 | } | |
483 | }); |
|
494 | }); | |
|
495 | ||||
|
496 | var select_all = $("#select-all"); | |||
484 | if (checked === 0) { |
|
497 | if (checked === 0) { | |
485 | $('#tree-selector input[type=checkbox]')[0].indeterminate = false; |
|
498 | select_all.prop('checked', false); | |
486 | $('#tree-selector input[type=checkbox]').prop('checked', false); |
|
499 | select_all.prop('indeterminate', false); | |
|
500 | select_all.data('indeterminate', false); | |||
487 | } else if (checked === total) { |
|
501 | } else if (checked === total) { | |
488 | $('#tree-selector input[type=checkbox]')[0].indeterminate = false; |
|
502 | select_all.prop('checked', true); | |
489 | $('#tree-selector input[type=checkbox]').prop('checked', true); |
|
503 | select_all.prop('indeterminate', false); | |
|
504 | select_all.data('indeterminate', false); | |||
490 | } else { |
|
505 | } else { | |
491 |
|
|
506 | select_all.prop('checked', false); | |
492 |
|
|
507 | select_all.prop('indeterminate', true); | |
|
508 | select_all.data('indeterminate', true); | |||
493 | } |
|
509 | } | |
494 | // Update total counter |
|
510 | // Update total counter | |
495 | $('#counter-select-all').html(checked===0 ? ' ' : checked); |
|
511 | $('#counter-select-all').html(checked===0 ? ' ' : checked); |
General Comments 0
You need to be logged in to leave comments.
Login now