Permalink
Browse files

ENHANCEMENT Using new *_Content templates for ModelAdmin and Security…

…Admin
  • Loading branch information...
1 parent 38bc2a9 commit 403d05726d473a417d22a5d0470a8b77dbbd05f4 @chillu chillu committed Apr 19, 2011
View
@@ -147,7 +147,6 @@ public function init() {
//user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
}
- Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/ModelAdmin.css'); // standard layout formatting for management UI
Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/silverstripe.tabs.css'); // follows the jQuery UI theme conventions
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
@@ -439,7 +438,7 @@ public function CreateForm() {
new FieldSet($createButton = new FormAction('add', $buttonLabel)),
$validator = new RequiredFields()
);
-
+ $createButton->addExtraClass('ss-ui-action-constructive');
$createButton->dontEscape = true;
$validator->setJavascriptValidationHandler('none');
$form->setHTMLID("Form_CreateForm_" . $this->modelClass);
@@ -847,7 +846,7 @@ public function AddForm() {
$actions = new FieldSet (
new FormAction("doCreate", _t('ModelAdmin.ADDBUTTON', "Add"))
);
-
+
$form = new Form($this, "AddForm", $fields, $actions, $validator);
$form->loadDataFrom($newRecord);
@@ -952,7 +951,8 @@ public function EditForm() {
$actions = $this->currentRecord->getCMSActions();
if($this->currentRecord->canEdit(Member::currentUser())){
if(!$actions->fieldByName('action_doSave') && !$actions->fieldByName('action_save')) {
- $actions->push(new FormAction("doSave", _t('ModelAdmin.SAVE', "Save")));
+ $actions->push($saveAction = new FormAction("doSave", _t('ModelAdmin.SAVE', "Save")));
+ $saveAction->addExtraClass('ss-ui-action-constructive');
}
}else{
$fields = $fields->makeReadonly();
@@ -962,7 +962,7 @@ public function EditForm() {
if(!$actions->fieldByName('action_doDelete')) {
$actions->insertFirst($deleteAction = new FormAction('doDelete', _t('ModelAdmin.DELETE', 'Delete')));
}
- $deleteAction->addExtraClass('delete');
+ $deleteAction->addExtraClass('delete ss-ui-action-destructive');
}
$form = new Form($this, "EditForm", $fields, $actions, $validator);
@@ -36,8 +36,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
public function init() {
parent::init();
- Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin_left.js');
- Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin_right.js');
+ Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin.js');
}
function getEditForm($id = null) {
@@ -174,6 +173,13 @@ function RootForm() {
return $form;
}
+ function AddForm() {
+ $form = parent::AddForm();
+ $form->Actions()->fieldByName('action_doAdd')->setTitle(_t('AssetAdmin.ActionAdd', 'Add folder'));
+
+ return $form;
+ }
+
public function memberimport() {
Requirements::clear();
Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
@@ -0,0 +1,43 @@
+<div class="cms-content center" data-layout="{type: 'border'}">
+
+ <div class="cms-content-header north">
+ <h2><% _t('ModelAdmin.Title', 'My Model') %></h2>
+ </div>
+
+
+ <div class="cms-content-tools west">
+
+ <div id="SearchForm_holder" class="leftbottom ss-tabset">
+ <% if SearchClassSelector = tabs %>
+ <ul>
+ <% control ModelForms %>
+ <li class="$FirstLast"><a id="tab-ModelAdmin_$Title.HTMLATT" href="#{$Form.Name}_$ClassName">$Title</a></li>
+ <% end_control %>
+ </ul>
+ <% end_if %>
+
+ <% if SearchClassSelector = dropdown %>
+ <div id="ModelClassSelector" class="ui-widget-container">
+ Search for:
+ <select>
+ <% control ModelForms %>
+ <option value="{$Form.Name}_$ClassName">$Title</option>
+ <% end_control %>
+ </select>
+ </div>
+ <% end_if %>
+
+ <% control ModelForms %>
+ <div class="tab" id="{$Form.Name}_$ClassName">
+ $Content
+ </div>
+ <% end_control %>
+ </div>
+
+ </div>
+
+ <div class="cms-content-form center ui-widget-content">
+ $EditForm
+ </div>
+
+</div>
@@ -0,0 +1 @@
+<% include Form %>
@@ -1,26 +0,0 @@
-<div id="SearchForm_holder" class="leftbottom ss-tabset">
- <% if SearchClassSelector = tabs %>
- <ul>
- <% control ModelForms %>
- <li class="$FirstLast"><a id="tab-ModelAdmin_$Title.HTMLATT" href="#{$Form.Name}_$ClassName">$Title</a></li>
- <% end_control %>
- </ul>
- <% end_if %>
-
- <% if SearchClassSelector = dropdown %>
- <p id="ModelClassSelector">
- Search for:
- <select>
- <% control ModelForms %>
- <option value="{$Form.Name}_$ClassName">$Title</option>
- <% end_control %>
- </select>
- </p>
- <% end_if %>
-
- <% control ModelForms %>
- <div class="tab" id="{$Form.Name}_$ClassName">
- $Content
- </div>
- <% end_control %>
-</div>
@@ -0,0 +1,36 @@
+<div class="cms-content center" data-layout="{type: 'border'}">
+
+ <div class="cms-content-header north">
+ <h2><% _t('SECGROUPS','Security Groups') %></h2>
+ </div>
+
+
+ <div class="cms-content-tools west">
+
+ <div id="treepanes">
+
+ <div>
+ $AddForm
+
+ <div class="checkboxAboveTree">
+ <input type="checkbox" id="sortitems" />
+ <label for="sortitems">
+ <% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %>
+ </label>
+ </div>
+
+ <div data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" class="cms-tree jstree jstree-apple">
+ $SiteTreeAsUL
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="cms-content-form center ui-widget-content">
+ $EditForm
+ </div>
+
+</div>
@@ -1,45 +0,0 @@
-<div id="treepanes">
- <h3>
- <a href="#"><% _t('SECGROUPS','Security Groups') %></a>
- </h3>
-
- <div>
- <div id="TreeActions">
-
- <ul>
- <li>
- <a href="#TreeActions-create" id="TreeActions-create-btn">
- <% _t('CREATE','Create',PR_HIGH) %>
- </a>
- </li>
- <li>
- <a href="#TreeActions-batchactions" id="batchactions">
- <% _t('BATCHACTIONS','Batch Actions',PR_HIGH) %>
- </a>
- </li>
- </ul>
-
- <div id="TreeActions-create">
- $AddForm
- </div>
-
- <div id="TreeActions-batchactions">
- $BatchActionsForm
- </div>
-
- </div>
-
- <div class="checkboxAboveTree">
- <input type="checkbox" id="sortitems" />
- <label for="sortitems">
- <% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %>
- </label>
- </div>
-
- <div data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" class="cms-tree jstree jstree-apple">
- $SiteTreeAsUL
- </div>
-
- </div>
-
-</div>
@@ -1,5 +1,4 @@
<% if CreateForm %>
- <h3><% _t('ADDLISTING','Add') %></h3>
$CreateForm
<% end_if %>

0 comments on commit 403d057

Please sign in to comment.