Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727041
D315.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 5:28 AM
Size
3 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 5:28 AM (2 d, 22 h ago)
Engine
blob
Format
Raw Data
Handle
537108
Attached To
D315: INP-1712 - Trigger "change" event, when checkbox value is changed by script
D315.diff
View Options
Index: branches/5.2.x/core/admin_templates/groups/groups_edit_permissions.tpl
===================================================================
--- branches/5.2.x/core/admin_templates/groups/groups_edit_permissions.tpl
+++ branches/5.2.x/core/admin_templates/groups/groups_edit_permissions.tpl
@@ -129,12 +129,13 @@
while($i < $permissions.length) {
$test_perm = '_cb_g-perm[' + $rets[1] + '][' + $permissions[$i] + ']';
$test_perm = document.getElementById($test_perm);
- if ($test_perm) {
- $test_perm.checked = $source_perm.checked;
- update_checkbox($test_perm, document.getElementById('g-perm[' + $rets[1] + '][' + $permissions[$i] + ']'));
+
+ if ( $test_perm && $test_perm.checked !== $source_perm.checked ) {
+ $($test_perm).prop('checked', $source_perm.checked).change();
}
+
$i++;
}
}
</script>
-<inp2:m_include t="incs/footer"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer"/>
Index: branches/5.2.x/core/admin_templates/js/grid_filters.js
===================================================================
--- branches/5.2.x/core/admin_templates/js/grid_filters.js
+++ branches/5.2.x/core/admin_templates/js/grid_filters.js
@@ -82,13 +82,16 @@
$('#' + jq($form_name)).append($div);
// set click handlers
- $('#_mutlioptions_cb_' + $cur_index + '_all')
- .click(
- function ($e) {
- MultiOptions.SelectAll($cur_index);
- }
- )
- .prop('checked', $options.length == $options.filter(':selected').length);
+ var $select_all = $('#_mutlioptions_cb_' + $cur_index + '_all'),
+ $new_checked = $options.length === $options.filter(':selected').length;
+
+ $select_all.click(function ($e) {
+ MultiOptions.SelectAll($cur_index);
+ });
+
+ if ( $select_all.prop('checked') !== $new_checked ) {
+ $select_all.prop('checked', $new_checked).change();
+ }
$('input._mutlioptions_cb_' + $cur_index).click(
function ($e) {
@@ -136,8 +139,11 @@
// update "Select All" checkbox
var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all');
var $options = $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all);
+ var $new_checked = $options.length === $options.filter(':checked').length;
- $select_all.prop('checked', $options.length == $options.filter(':checked').length);
+ if ( $select_all.prop('checked') !== $new_checked ) {
+ $select_all.prop('checked', $new_checked).change();
+ }
}
MultiOptions.SelectAll = function(selector_index) {
@@ -145,7 +151,13 @@
var $select_all = $('#_mutlioptions_cb_' + selector_index + '_all');
var $checked = $select_all.prop('checked');
- $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all).prop('checked', $checked);
+ $("input[type='checkbox']", '#' + jq(MultiOptions.Selectors[selector_index]) + '_div').not($select_all).each(function () {
+ var $checkbox = $(this);
+
+ if ( $checkbox.prop('checked') !== $checked ) {
+ $checkbox.prop('checked', $checked).change();
+ }
+ });
// sync hidden field
var $reg_exp = new RegExp('^_mutlioptions_cb_' + selector_index + '_(?!all)([0-9A-Za-z-]+)');
Event Timeline
Log In to Comment