mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Using new *_Content templates for ModelAdmin and SecurityAdmin
This commit is contained in:
parent
38bc2a9d73
commit
403d05726d
@ -147,7 +147,6 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
//user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
|
//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::css(SAPPHIRE_ADMIN_DIR . '/css/silverstripe.tabs.css'); // follows the jQuery UI theme conventions
|
||||||
|
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
||||||
@ -439,7 +438,7 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
new FieldSet($createButton = new FormAction('add', $buttonLabel)),
|
new FieldSet($createButton = new FormAction('add', $buttonLabel)),
|
||||||
$validator = new RequiredFields()
|
$validator = new RequiredFields()
|
||||||
);
|
);
|
||||||
|
$createButton->addExtraClass('ss-ui-action-constructive');
|
||||||
$createButton->dontEscape = true;
|
$createButton->dontEscape = true;
|
||||||
$validator->setJavascriptValidationHandler('none');
|
$validator->setJavascriptValidationHandler('none');
|
||||||
$form->setHTMLID("Form_CreateForm_" . $this->modelClass);
|
$form->setHTMLID("Form_CreateForm_" . $this->modelClass);
|
||||||
@ -847,7 +846,7 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
$actions = new FieldSet (
|
$actions = new FieldSet (
|
||||||
new FormAction("doCreate", _t('ModelAdmin.ADDBUTTON', "Add"))
|
new FormAction("doCreate", _t('ModelAdmin.ADDBUTTON', "Add"))
|
||||||
);
|
);
|
||||||
|
|
||||||
$form = new Form($this, "AddForm", $fields, $actions, $validator);
|
$form = new Form($this, "AddForm", $fields, $actions, $validator);
|
||||||
$form->loadDataFrom($newRecord);
|
$form->loadDataFrom($newRecord);
|
||||||
|
|
||||||
@ -952,7 +951,8 @@ class ModelAdmin_RecordController extends Controller {
|
|||||||
$actions = $this->currentRecord->getCMSActions();
|
$actions = $this->currentRecord->getCMSActions();
|
||||||
if($this->currentRecord->canEdit(Member::currentUser())){
|
if($this->currentRecord->canEdit(Member::currentUser())){
|
||||||
if(!$actions->fieldByName('action_doSave') && !$actions->fieldByName('action_save')) {
|
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{
|
}else{
|
||||||
$fields = $fields->makeReadonly();
|
$fields = $fields->makeReadonly();
|
||||||
@ -962,7 +962,7 @@ class ModelAdmin_RecordController extends Controller {
|
|||||||
if(!$actions->fieldByName('action_doDelete')) {
|
if(!$actions->fieldByName('action_doDelete')) {
|
||||||
$actions->insertFirst($deleteAction = new FormAction('doDelete', _t('ModelAdmin.DELETE', 'Delete')));
|
$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);
|
$form = new Form($this, "EditForm", $fields, $actions, $validator);
|
||||||
|
@ -36,8 +36,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
public function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin_left.js');
|
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin.js');
|
||||||
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/SecurityAdmin_right.js');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditForm($id = null) {
|
function getEditForm($id = null) {
|
||||||
@ -174,6 +173,13 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AddForm() {
|
||||||
|
$form = parent::AddForm();
|
||||||
|
$form->Actions()->fieldByName('action_doAdd')->setTitle(_t('AssetAdmin.ActionAdd', 'Add folder'));
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
public function memberimport() {
|
public function memberimport() {
|
||||||
Requirements::clear();
|
Requirements::clear();
|
||||||
Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
|
Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
|
||||||
|
43
admin/templates/Includes/ModelAdmin_Content.ss
Normal file
43
admin/templates/Includes/ModelAdmin_Content.ss
Normal file
@ -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>
|
1
admin/templates/Includes/ModelAdmin_EditForm.ss
Normal file
1
admin/templates/Includes/ModelAdmin_EditForm.ss
Normal file
@ -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>
|
|
36
admin/templates/Includes/SecurityAdmin_Content.ss
Normal file
36
admin/templates/Includes/SecurityAdmin_Content.ss
Normal file
@ -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 & 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 & 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 %>
|
<% if CreateForm %>
|
||||||
<h3><% _t('ADDLISTING','Add') %></h3>
|
|
||||||
$CreateForm
|
$CreateForm
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user