mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1554 from open-sausages/pulls/4.0/bootify-forms-addpage
Add page styles based on the new bootstrap forms
This commit is contained in:
commit
006d03eacc
@ -20,6 +20,7 @@ $.entwine('ss', function($){
|
||||
ParentCache: {}, // Cache allowed children for each selected page
|
||||
onadd: function() {
|
||||
var self = this;
|
||||
// See SelectionGroup.js for logic which hides / shows ParentID
|
||||
this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField').bind('change', function() {
|
||||
self.updateTypeList();
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
public function AddForm() {
|
||||
$pageTypes = array();
|
||||
foreach($this->PageTypes() as $type) {
|
||||
$html = sprintf('<span class="page-icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>',
|
||||
$html = sprintf('<span class="page-icon class-%s"></span><span class="title">%s</span><span class="form__field-description">%s</span>',
|
||||
$type->getField('ClassName'),
|
||||
$type->getField('AddAction'),
|
||||
$type->getField('Description')
|
||||
@ -39,13 +39,12 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
$pageTypes = array_merge(array('Page' => $pageTitle), $pageTypes);
|
||||
}
|
||||
|
||||
$numericLabelTmpl = '<div><label class="left"><span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><span class="title">%s</span></span></label></div>';
|
||||
$numericLabelTmpl = '<span class="step-label"><span class="flyout">Step %d. </span><span class="title">%s</span></span>';
|
||||
|
||||
$topTitle = _t('CMSPageAddController.ParentMode_top', 'Top level');
|
||||
$childTitle = _t('CMSPageAddController.ParentMode_child', 'Under another page');
|
||||
|
||||
$fields = new FieldList(
|
||||
new LiteralField('PageModeHeader', sprintf($numericLabelTmpl, 1, _t('CMSMain.ChoosePageParentMode', 'Choose where to create this page'))),
|
||||
$parentModeField = new SelectionGroup(
|
||||
"ParentModeField",
|
||||
array(
|
||||
@ -67,15 +66,6 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
)
|
||||
)
|
||||
),
|
||||
$typeField = new OptionsetField(
|
||||
"PageType",
|
||||
DBField::create_field(
|
||||
'HTMLFragment',
|
||||
sprintf($numericLabelTmpl, 2, _t('CMSMain.ChoosePageType', 'Choose page type'))
|
||||
),
|
||||
$pageTypes,
|
||||
'Page'
|
||||
),
|
||||
new LiteralField(
|
||||
'RestrictedNote',
|
||||
sprintf(
|
||||
@ -85,8 +75,23 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
'Note: Some page types are not allowed for this selection'
|
||||
)
|
||||
)
|
||||
),
|
||||
$typeField = new OptionsetField(
|
||||
"PageType",
|
||||
DBField::create_field(
|
||||
'HTMLFragment',
|
||||
sprintf($numericLabelTmpl, 2, _t('CMSMain.ChoosePageType', 'Choose page type'))
|
||||
),
|
||||
$pageTypes,
|
||||
'Page'
|
||||
)
|
||||
);
|
||||
|
||||
$parentModeField->setTitle(DBField::create_field(
|
||||
'HTMLFragment',
|
||||
sprintf($numericLabelTmpl, 1, _t('CMSMain.ChoosePageParentMode', 'Choose where to create this page'))
|
||||
));
|
||||
|
||||
$parentField->setSearchFunction(function ($sourceObject, $labelField, $search) {
|
||||
return DataObject::get($sourceObject)
|
||||
->filterAny([
|
||||
@ -140,7 +145,7 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
));
|
||||
}
|
||||
});
|
||||
$form->addExtraClass('cms-add-form stacked cms-content center cms-edit-form ' . $this->BaseCSSClasses());
|
||||
$form->addExtraClass('cms-add-form cms-content center cms-edit-form ' . $this->BaseCSSClasses());
|
||||
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
|
||||
|
||||
return $form;
|
||||
|
@ -1,13 +1,19 @@
|
||||
<div class="cms-content center $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
|
||||
<% with $AddForm %>
|
||||
<form $FormAttributes data-layout-type="border">
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header-info">
|
||||
<h2><% _t('CMSAddPageController.Title','Add page') %></h2>
|
||||
<div class="toolbar--north container-fluid">
|
||||
<div class="toolbar__navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb__item breadcrumb__item--last">
|
||||
<h2 class="breadcrumb__item-title breadcrumb__item-title--last">
|
||||
<% _t('CMSAddPageController.Title','Add page') %>
|
||||
</h2>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cms-content-fields center cms-panel-content cms-panel-padded">
|
||||
<div class="panel-scrollable panel-scrollable--double-toolbar container-fluid cms-panel-padded">
|
||||
<% if $Message %>
|
||||
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
|
||||
<% else %>
|
||||
|
Loading…
Reference in New Issue
Block a user