Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Disable batch action selection unless we're in multiselec…

…t mode (no way to single select in tree), updating chosen.js and jquery.button state properly
  • Loading branch information...
commit 6b910ca25f769e1d5d968ff050113e54dc996193 1 parent 0ede949
@chillu chillu authored
Showing with 14 additions and 4 deletions.
  1. +14 −4 admin/javascript/LeftAndMain.BatchActions.js
View
18 admin/javascript/LeftAndMain.BatchActions.js
@@ -45,12 +45,17 @@
});
$('.cms-tree-view-modes :input[name=view-mode]').bind('click', function(e) {
- if($(e.target).val() == 'multiselect') {
+ var val = $(e.target).val(), dropdown = self.find(':input[name=Action]');
+ if(val == 'multiselect') {
tree.addClass('multiple');
self.serializeFromTree();
} else {
tree.removeClass('multiple');
}
+
+ // Batch actions only make sense when multiselect is enabled
+ if(val == 'multiselect') dropdown.removeAttr('disabled').change();
+ else dropdown.attr('disabled', 'disabled').change();
});
this._super();
@@ -304,11 +309,16 @@
onchange: function(e) {
var form = $(e.target.form), btn = form.find(':submit');
if($(e.target).val() == -1) {
- btn.attr('disabled', 'disabled');
+ btn.attr('disabled', 'disabled').button('refresh');
} else {
- btn.removeAttr('disabled');
- form.submit();
+ btn.removeAttr('disabled').button('refresh');
+ // form.submit();
}
+
+ // TODO Should work by triggering change() along, but doesn't - entwine event bubbling?
+ this.trigger("liszt:updated");
+
+ this._super(e);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.