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