Fix selected view mode not reflected on button

Fix other ModelAdmin layout (test)
Fix fieldholder placement
This commit is contained in:
Christopher Joe 2016-10-10 11:39:24 +13:00 committed by Damian Mooyman
parent 89150c48e7
commit 7acb3b5fc2
8 changed files with 25 additions and 11 deletions

View File

@ -254,7 +254,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
'type' => 'Includes', 'type' => 'Includes',
'SilverStripe\\Admin\\LeftAndMain_EditForm', 'SilverStripe\\Admin\\LeftAndMain_EditForm',
]); ]);
$form->addExtraClass('cms-content cms-edit-form center'); $form->addExtraClass('cms-content cms-edit-form center flexbox-area-grow');
$form->setAttribute('data-pjax-fragment', 'CurrentForm Content'); $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
if ($form->Fields()->hasTabSet()) { if ($form->Fields()->hasTabSet()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('SilverStripe\\Forms\\CMSTabSet'); $form->Fields()->findOrMakeTab('Root')->setTemplate('SilverStripe\\Forms\\CMSTabSet');

View File

@ -8623,6 +8623,10 @@ form.nostyle .TreeDropdownField,form.nostyle input.text,form.nostyle select,form
max-width:auto; max-width:auto;
} }
fieldset{
width:100%;
}
.field.ui-tabs{ .field.ui-tabs{
border-bottom:0; border-bottom:0;
} }

View File

@ -60,7 +60,7 @@ function fieldHolder(Field) {
// The extraClass property is defined on both the holder and element // The extraClass property is defined on both the holder and element
// for legacy reasons (same behaviour as PHP rendering) // for legacy reasons (same behaviour as PHP rendering)
const classNames = [ const classNames = [
'field form__field-holder', 'field',
this.props.extraClass, this.props.extraClass,
]; ];
if (this.props.readOnly) { if (this.props.readOnly) {
@ -81,7 +81,9 @@ function fieldHolder(Field) {
return ( return (
<FormGroup {...this.getHolderProps()}> <FormGroup {...this.getHolderProps()}>
{this.getLeftTitle()} {this.getLeftTitle()}
<div className="form__field-holder">
<Field {...this.props} /> <Field {...this.props} />
</div>
{this.getRightTitle()} {this.getRightTitle()}
{this.getDescription()} {this.getDescription()}
</FormGroup> </FormGroup>

View File

@ -119,6 +119,8 @@ $.entwine('ss.preview', function($){
if(save !== false) this.saveState('mode', modeName); if(save !== false) this.saveState('mode', modeName);
this.redraw();
return this; return this;
}, },
@ -289,6 +291,10 @@ $.entwine('ss.preview', function($){
} }
}, },
onforcecontent: function () {
this.changeMode('content', false);
},
onenable: function () { onenable: function () {
var $viewModeSelector = $('.preview-mode-selector'); var $viewModeSelector = $('.preview-mode-selector');

View File

@ -336,15 +336,16 @@ $.entwine('ss', function($) {
} else { } else {
preview.css('min-width', options.minPreviewWidth); preview.css('min-width', options.minPreviewWidth);
} }
$('.cms-preview').trigger('enable'); preview.trigger('enable');
} else { } else {
$('.cms-preview').trigger('disable'); preview.trigger('disable');
if (mode == 'split') { if (mode == 'split') {
// force change mode and leave it redraw after // force change mode and leave it redraw after
this.contentViewMode(); preview.trigger('forcecontent');
return true; return true;
} }
} }
this.addClass('cms-container--' + mode + '-mode'); this.addClass('cms-container--' + mode + '-mode');
return false; return false;
}, },

View File

@ -14,9 +14,10 @@ form.nostyle {
@include clear-form-field-styles(); @include clear-form-field-styles();
} }
// fieldset { // need this for consistent <fieldset> behaviour
// width: 100%; fieldset {
// } width: 100%;
}
.field { // TODO convert to .form-group .field { // TODO convert to .form-group

View File

@ -173,7 +173,7 @@ abstract class ModelAdmin extends LeftAndMain {
new FieldList($listField), new FieldList($listField),
new FieldList() new FieldList()
)->setHTMLID('Form_EditForm'); )->setHTMLID('Form_EditForm');
$form->addExtraClass('cms-edit-form cms-panel-padded center'); $form->addExtraClass('cms-edit-form cms-panel-padded center flexbox-area-grow');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$editFormAction = Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm'); $editFormAction = Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm');
$form->setFormAction($editFormAction); $form->setFormAction($editFormAction);

View File

@ -1,4 +1,4 @@
<div class="cms-content cms-tabset center $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content"> <div class="cms-content flexbox-area-grow cms-tabset center $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
<div class="cms-content-header north"> <div class="cms-content-header north">
<div class="cms-content-header-info"> <div class="cms-content-header-info">