From 07bc75c281a787e53441f159d10616b4beccba1e Mon Sep 17 00:00:00 2001 From: Jeremy Bridson Date: Wed, 26 Sep 2012 13:19:26 +1200 Subject: [PATCH] ENHANCEMENT: open/7881 - removed disabled checkboxes and replaced them with green ticks. Added help text above the list of permissions. Removed action buttons by fade out when user goes to users permissions tab. --- admin/css/screen.css | 8 +++++++ admin/scss/_SecurityAdmin.scss | 27 ++++++++++++++++++++++++ javascript/PermissionCheckboxSetField.js | 3 ++- security/PermissionCheckboxSetField.php | 26 +++++++++++++++++------ 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/admin/css/screen.css b/admin/css/screen.css index 481083620..eaa8aee48 100644 --- a/admin/css/screen.css +++ b/admin/css/screen.css @@ -852,5 +852,13 @@ li.class-ErrorPage > a .jstree-pageicon { background-position: 0 -112px; } .SecurityAdmin .permissioncheckboxset .optionset li, .SecurityAdmin .permissioncheckboxsetfield_readonly .optionset li { float: none; width: auto; } +/* For user permissions the readonly checkboxes are set as display none and are replaced with a that has a +green tick icon as a background this is created using compass generated classes and hardcoded in the php */ +.permissioncheckboxsetfield_readonly .optionset li.odd, .permissioncheckboxsetfield_readonly .optionset li.even { margin-left: 16px; } +.permissioncheckboxsetfield_readonly .optionset li.help { width: 384px; } +.permissioncheckboxsetfield_readonly .optionset li input { display: none; } +.permissioncheckboxsetfield_readonly .optionset li label { position: relative; } +.permissioncheckboxsetfield_readonly .optionset li label span { position: absolute; left: -16px; top: -2px; } + .cms .cms-content .SecurityAdmin .cms-content-fields { overflow-y: auto; } .cms .cms-content .SecurityAdmin .cms-content-fields .aligned-right-label { margin-left: 184px; padding: 8px 0; } diff --git a/admin/scss/_SecurityAdmin.scss b/admin/scss/_SecurityAdmin.scss index a488843a9..d815717d6 100644 --- a/admin/scss/_SecurityAdmin.scss +++ b/admin/scss/_SecurityAdmin.scss @@ -10,6 +10,33 @@ } } +/* For user permissions the readonly checkboxes are set as display none and are replaced with a that has a +green tick icon as a background this is created using compass generated classes and hardcoded in the php */ + +.permissioncheckboxsetfield_readonly { + .optionset { + li { + &.odd, &.even { + margin-left:$grid-x*2; // aligns the labels after input is set to display none. + } + &.help{ + width:$grid-x*48; + } + input { + display:none; + } + label { + position:relative; // needs to be set to position the span element correctly + span { // background set using compass generated classes (background is green tick icon) + position:absolute; + left:$grid-x*-2; + top:-2px; + } + } + } + } +} + .cms .cms-content .SecurityAdmin { //datagrid overflow on Security Admin .cms-content-fields { overflow-y:auto; diff --git a/javascript/PermissionCheckboxSetField.js b/javascript/PermissionCheckboxSetField.js index 73b1eaa4e..ef53e910e 100644 --- a/javascript/PermissionCheckboxSetField.js +++ b/javascript/PermissionCheckboxSetField.js @@ -83,6 +83,7 @@ } } }); - + }); + }(jQuery)); diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 8fb92b763..2c480a489 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -184,20 +184,32 @@ class PermissionCheckboxSetField extends FormField { // show its origin automatically $inheritMessage = ' (' . join(', ', $uninheritedCodes[$code]).')'; } - + // If the field is readonly, always mark as "disabled" if($this->readonly) $disabled = ' disabled="true"'; $inheritMessage = '' . $inheritMessage . ''; - $options .= "
  • " . - "name[$code]\" type=\"checkbox\" value=\"$code\"$checked class=\"checkbox\" />" . - "" . - "
  • \n"; + + // If the field is readonly, add a span that will replace the disabled checkbox input + if($this->readonly) { + $options .= "
  • " . + "name[$code]\" type=\"checkbox\" value=\"$code\"$checked class=\"checkbox\" />" . + "" . + "
  • \n"; + } else { + $options .= "
  • " . + "name[$code]\" type=\"checkbox\" value=\"$code\"$checked class=\"checkbox\" />" . + "" . + "
  • \n"; + } } } } - - return "
      id()}\" class=\"optionset checkboxsetfield{$this->extraClass()}\">\n$options
    \n"; + if($this->readonly) { + return "
      id()}\" class=\"optionset checkboxsetfield{$this->extraClass()}\">\n
    • Assigning groups to this user will adjust the permissions they have. See the groups section for details of permissions on individual groups.
    • $options
    \n"; + } else { + return "
      id()}\" class=\"optionset checkboxsetfield{$this->extraClass()}\">\n$options
    \n"; + } } /**