Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Moved permission checkbox logic from SecurityAdmin.js to Member…

…TableField.js in order to have it working in the member popup as well

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@99602 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit f90f66aedd4d9bd5d175d0f56ff863caaaf044cc 1 parent f22f2e2
@chillu chillu authored
Showing with 36 additions and 31 deletions.
  1. +36 −0 javascript/MemberTableField.js
  2. +0 −31 javascript/SecurityAdmin.js
View
36 javascript/MemberTableField.js
@@ -1,3 +1,39 @@
+(function($) {
+ $.concrete('ss', function($){
+ /**
+ * Automatically check and disable all checkboxes if ADMIN permissions are selected.
+ * As they're disabled, any changes won't be submitted (which is intended behaviour),
+ * checking all boxes is purely presentational.
+ */
+ $('#Permissions .checkbox[value=ADMIN]').concrete({
+ onmatch: function() {
+ this.toggleCheckboxes();
+
+ this._super();
+ },
+ onclick: function(e) {
+ this.toggleCheckboxes();
+ },
+ toggleCheckboxes: function() {
+ var self = this, checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this);
+
+ if(this.is(':checked')) {
+ checkboxes.each(function() {
+ $(this).data('SecurityAdmin.oldChecked', $(this).attr('checked'));
+ $(this).attr('disabled', 'disabled');
+ $(this).attr('checked', 'checked');
+ });
+ } else {
+ checkboxes.each(function() {
+ $(this).attr('checked', $(this).data('SecurityAdmin.oldChecked'));
+ $(this).attr('disabled', '');
+ });
+ }
+ }
+ });
+ });
+}(jQuery));
+
/**
* Modified 2006-10-05, Ingo Schommer
* This is more or less a copy of Member.js, with additions and changes
View
31 javascript/SecurityAdmin.js
@@ -61,37 +61,6 @@
return false;
}
});
-
- /**
- * Automatically check and disable all checkboxes if ADMIN permissions are selected.
- * As they're disabled, any changes won't be submitted (which is intended behaviour),
- * checking all boxes is purely presentational.
- */
- $('#Form_EditForm #Permissions .checkbox[value=ADMIN]').concrete({
- onmatch: function() {
- this.toggleCheckboxes();
-
- this._super();
- },
- onclick: function(e) {
- this.toggleCheckboxes();
- },
- toggleCheckboxes: function() {
- var self = this, checkboxes = this.parents('.permissioncheckboxset:eq(0)').find('.checkbox').not(this);
- if(this.is(':checked')) {
- checkboxes.each(function() {
- $(this).data('SecurityAdmin.oldChecked', $(this).attr('checked'));
- $(this).attr('disabled', 'disabled');
- $(this).attr('checked', 'checked');
- });
- } else {
- checkboxes.each(function() {
- $(this).attr('checked', $(this).data('SecurityAdmin.oldChecked'));
- $(this).attr('disabled', '');
- });
- }
- }
- });
});
}(jQuery));
Please sign in to comment.
Something went wrong with that request. Please try again.