Pages area: remove layout classes, replace with flexbox CSS classes

This commit is contained in:
Paul Clarke 2016-10-04 17:31:54 +13:00 committed by Damian Mooyman
parent ed4270155b
commit 1fd46ed36d
11 changed files with 38 additions and 77 deletions

View File

@ -1169,7 +1169,7 @@ path:"/",expires:31})},clearPersistedCollapsedState:function r(){this.canSetCook
return void 0===e&&(e=this.hasClass("collapsed")),e},onadd:function a(){var t,n return void 0===e&&(e=this.hasClass("collapsed")),e},onadd:function a(){var t,n
if(!this.find(".cms-panel-content").length)throw new Exception('Content panel for ".cms-panel" not found') if(!this.find(".cms-panel-content").length)throw new Exception('Content panel for ".cms-panel" not found')
this.find(".cms-panel-toggle").length||(n=e("<div class='cms-panel-toggle south'></div>").append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>').append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>'), this.find(".cms-panel-toggle").length||(n=e("<div class='toolbar toolbar--south cms-panel-toggle'></div>").append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>').append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>'),
this.append(n)),this.setWidthExpanded(this.find(".cms-panel-content").innerWidth()),t=this.find(".cms-panel-content-collapsed"),this.setWidthCollapsed(t.length?t.innerWidth():this.find(".toggle-expand").innerWidth()), this.append(n)),this.setWidthExpanded(this.find(".cms-panel-content").innerWidth()),t=this.find(".cms-panel-content-collapsed"),this.setWidthCollapsed(t.length?t.innerWidth():this.find(".toggle-expand").innerWidth()),
this.togglePanel(!this.getInitialCollapsedState(),!0,!1),this._super()},togglePanel:function s(e,t,n){var i,r this.togglePanel(!this.getInitialCollapsedState(),!0,!1),this._super()},togglePanel:function s(e,t,n){var i,r
t||(this.trigger("beforetoggle.sspanel",e),this.trigger(e?"beforeexpand":"beforecollapse")),this.toggleClass("collapsed",!e),i=e?this.getWidthExpanded():this.getWidthCollapsed(),this.width(i),r=this.find(".cms-panel-content-collapsed"), t||(this.trigger("beforetoggle.sspanel",e),this.trigger(e?"beforeexpand":"beforecollapse")),this.toggleClass("collapsed",!e),i=e?this.getWidthExpanded():this.getWidthCollapsed(),this.width(i),r=this.find(".cms-panel-content-collapsed"),

View File

@ -9328,10 +9328,6 @@ div.switch-states .switch a.active span{
margin-left:5px; margin-left:5px;
} }
.toolbar--south.cms-content-actions{
width:100% !important;
}
.file input.file{ .file input.file{
opacity:1; opacity:1;
} }
@ -9352,6 +9348,7 @@ body.cms{
.cms-container{ .cms-container{
height:100%; height:100%;
width:100%;
background:#f6f7f8; background:#f6f7f8;
} }
@ -9500,18 +9497,6 @@ body.cms{
height:26px; height:26px;
} }
.has-panel .cms-content-tools{
position:relative !important;
}
.has-panel .cms-content-tools .cms-panel-content{
height:calc(100% - 53px) !important;
}
.has-panel .cms-content-tools .cms-helper-hide-actions{
height:100% !important;
}
.cms-versions-form .form-group:after{ .cms-versions-form .form-group:after{
visibility:hidden; visibility:hidden;
margin:0; margin:0;
@ -9705,6 +9690,9 @@ body.cms{
.ui-tabs .ui-tabs-panel.cms-edit-form{ .ui-tabs .ui-tabs-panel.cms-edit-form{
padding:0; padding:0;
display:-webkit-box;
display:-ms-flexbox;
display:flex;
} }
.ui-tabs .ui-tabs-panel .ui-tabs .ui-tabs-nav{ .ui-tabs .ui-tabs-panel .ui-tabs .ui-tabs-nav{
@ -10176,7 +10164,6 @@ body.cms{
z-index:70; z-index:70;
box-shadow:1px 0 0 0 #ced3d9; box-shadow:1px 0 0 0 #ced3d9;
z-index:1000; z-index:1000;
float:left;
position:relative; position:relative;
} }
@ -10190,8 +10177,6 @@ body.cms{
.cms-content-tools .cms-panel-content{ .cms-content-tools .cms-panel-content{
width:300px; width:300px;
overflow:auto;
height:100%;
} }
.cms-content-tools .cms-panel-content .btn-toolbar .ss-ui-action-constructive{ .cms-content-tools .cms-panel-content .btn-toolbar .ss-ui-action-constructive{
@ -10590,7 +10575,7 @@ form.member-profile-form #Permissions .optionset li{
cursor:pointer; cursor:pointer;
} }
.cms-panel.collapsed .cms-panel-content,.cms-panel.collapsed .cms-panel-header *,.cms-panel.collapsed .cms-panel-toggle a.toggle-collapse{ .cms-panel.collapsed .cms-panel-content>*,.cms-panel.collapsed .cms-panel-header *,.cms-panel.collapsed .cms-panel-toggle a.toggle-collapse{
display:none; display:none;
} }
@ -15454,7 +15439,6 @@ div.grid-field__sort-field+.form__fieldgroup-item{
.toolbar--south{ .toolbar--south{
padding-top:.76925rem; padding-top:.76925rem;
padding-bottom:.76925rem; padding-bottom:.76925rem;
position:absolute;
bottom:0; bottom:0;
border-top:1px solid #d9dee2; border-top:1px solid #d9dee2;
width:100%; width:100%;
@ -16001,7 +15985,6 @@ input.checkbox,input.radio,input[type=checkbox],input[type=radio]{
.panel--scrollable{ .panel--scrollable{
overflow-y:auto; overflow-y:auto;
height:100%;
} }
.panel--single-toolbar{ .panel--single-toolbar{
@ -16063,10 +16046,6 @@ h1{
display:none; display:none;
} }
.toolbar--north,.toolbar--south{
height:52px;
}
.panel--scrollable{ .panel--scrollable{
overflow:auto; overflow:auto;
} }
@ -16096,6 +16075,9 @@ h1{
-ms-flex:1; -ms-flex:1;
-webkit-box-flex:1; -webkit-box-flex:1;
flex:1; flex:1;
display:-webkit-box;
display:-ms-flexbox;
display:flex;
} }
.campaign-admin__item-links--has-links,.campaign-admin__item-links--is-linked{ .campaign-admin__item-links--has-links,.campaign-admin__item-links--is-linked{

View File

@ -68,7 +68,6 @@
.toolbar--south { .toolbar--south {
padding-top: $spacer-xs; padding-top: $spacer-xs;
padding-bottom: $spacer-xs; padding-bottom: $spacer-xs;
position: absolute;
bottom: 0; bottom: 0;
border-top: 1px solid $border-color; border-top: 1px solid $border-color;
width: 100%; width: 100%;

View File

@ -7,13 +7,13 @@ $.entwine('ss', function($) {
/** /**
* Horizontal collapsible panel. Generic enough to work with CMS menu as well as various "filter" panels. * Horizontal collapsible panel. Generic enough to work with CMS menu as well as various "filter" panels.
* *
* A panel consists of the following parts: * A panel consists of the following parts:
* - Container div: The outer element, with class ".cms-panel" * - Container div: The outer element, with class ".cms-panel"
* - Header (optional) * - Header (optional)
* - Content * - Content
* - Expand and collapse toggle anchors (optional) * - Expand and collapse toggle anchors (optional)
* *
* Sample HTML: * Sample HTML:
* <div class="cms-panel"> * <div class="cms-panel">
* <div class="cms-panel-header">your header</div> * <div class="cms-panel-header">your header</div>
@ -25,9 +25,9 @@ $.entwine('ss', function($) {
* </div> * </div>
*/ */
$('.cms-panel').entwine({ $('.cms-panel').entwine({
WidthExpanded: null, WidthExpanded: null,
WidthCollapsed: null, WidthCollapsed: null,
/** /**
@ -99,26 +99,26 @@ $.entwine('ss', function($) {
var collapsedContent, container; var collapsedContent, container;
if(!this.find('.cms-panel-content').length) throw new Exception('Content panel for ".cms-panel" not found'); if(!this.find('.cms-panel-content').length) throw new Exception('Content panel for ".cms-panel" not found');
// Create default controls unless they already exist. // Create default controls unless they already exist.
if(!this.find('.cms-panel-toggle').length) { if(!this.find('.cms-panel-toggle').length) {
container = $("<div class='cms-panel-toggle south'></div>") container = $("<div class='toolbar toolbar--south cms-panel-toggle'></div>")
.append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>') .append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>')
.append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>'); .append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>');
this.append(container); this.append(container);
} }
// Set panel width same as the content panel it contains. Assumes the panel has overflow: hidden. // Set panel width same as the content panel it contains. Assumes the panel has overflow: hidden.
this.setWidthExpanded(this.find('.cms-panel-content').innerWidth()); this.setWidthExpanded(this.find('.cms-panel-content').innerWidth());
// Assumes the collapsed width is indicated by the toggle, or by an optionally collapsed view // Assumes the collapsed width is indicated by the toggle, or by an optionally collapsed view
collapsedContent = this.find('.cms-panel-content-collapsed'); collapsedContent = this.find('.cms-panel-content-collapsed');
this.setWidthCollapsed(collapsedContent.length ? collapsedContent.innerWidth() : this.find('.toggle-expand').innerWidth()); this.setWidthCollapsed(collapsedContent.length ? collapsedContent.innerWidth() : this.find('.toggle-expand').innerWidth());
// Toggle visibility // Toggle visibility
this.togglePanel(!this.getInitialCollapsedState(), true, false); this.togglePanel(!this.getInitialCollapsedState(), true, false);
this._super(); this._super();
}, },
@ -139,9 +139,9 @@ $.entwine('ss', function($) {
this.toggleClass('collapsed', !doExpand); this.toggleClass('collapsed', !doExpand);
newWidth = doExpand ? this.getWidthExpanded() : this.getWidthCollapsed(); newWidth = doExpand ? this.getWidthExpanded() : this.getWidthCollapsed();
this.width(newWidth); // the content panel width always stays in "expanded state" to avoid floating elements this.width(newWidth); // the content panel width always stays in "expanded state" to avoid floating elements
// If an alternative collapsed view exists, toggle it as well // If an alternative collapsed view exists, toggle it as well
collapsedContent = this.find('.cms-panel-content-collapsed'); collapsedContent = this.find('.cms-panel-content-collapsed');
if(collapsedContent.length) { if(collapsedContent.length) {
@ -160,13 +160,13 @@ $.entwine('ss', function($) {
this.trigger(doExpand ? 'expand' : 'collapse'); this.trigger(doExpand ? 'expand' : 'collapse');
// } // }
}, },
expandPanel: function(force) { expandPanel: function(force) {
if(!force && !this.hasClass('collapsed')) return; if(!force && !this.hasClass('collapsed')) return;
this.togglePanel(true); this.togglePanel(true);
}, },
collapsePanel: function(force) { collapsePanel: function(force) {
if(!force && this.hasClass('collapsed')) return; if(!force && this.hasClass('collapsed')) return;
@ -180,13 +180,13 @@ $.entwine('ss', function($) {
e.preventDefault(); e.preventDefault();
} }
}); });
$('.cms-panel *').entwine({ $('.cms-panel *').entwine({
getPanel: function() { getPanel: function() {
return this.parents('.cms-panel:first'); return this.parents('.cms-panel:first');
} }
}); });
$('.cms-panel .toggle-expand').entwine({ $('.cms-panel .toggle-expand').entwine({
onclick: function(e) { onclick: function(e) {
e.preventDefault(); e.preventDefault();
@ -197,7 +197,7 @@ $.entwine('ss', function($) {
this._super(e); this._super(e);
} }
}); });
$('.cms-panel .toggle-collapse').entwine({ $('.cms-panel .toggle-collapse').entwine({
onclick: function(e) { onclick: function(e) {
e.preventDefault(); e.preventDefault();

View File

@ -99,7 +99,6 @@
// Scrolling panels // Scrolling panels
.panel--scrollable { .panel--scrollable {
overflow-y: auto; overflow-y: auto;
height: 100%;
} }
// Panel height adjustments for scrolling // Panel height adjustments for scrolling
@ -177,10 +176,6 @@ h1 {
// width: 150px; // width: 150px;
} }
.toolbar--north,
.toolbar--south {
height: 52px;
}
// Scrollable area // Scrollable area
.panel--scrollable { .panel--scrollable {
@ -211,4 +206,5 @@ h1 {
.flexbox-area-grow { .flexbox-area-grow {
-ms-flex: 1; -ms-flex: 1;
flex: 1; flex: 1;
display: flex; // Only required for divs already positioned block as override
} }

View File

@ -846,10 +846,6 @@ div.switch-states{
margin-left: 5px; margin-left: 5px;
} }
.toolbar--south.cms-content-actions {
width: 100% !important;
}
// Override Bootstrap hidden file upload until they have a good way of showing uploaded file names // Override Bootstrap hidden file upload until they have a good way of showing uploaded file names
.file input.file { .file input.file {
opacity: 1; opacity: 1;

View File

@ -45,6 +45,7 @@ body.cms {
// -------------------------------------------- // --------------------------------------------
.cms-container { .cms-container {
height: 100%; height: 100%;
width: 100%;
background: $tab-panel-texture-color; background: $tab-panel-texture-color;
} }
@ -222,19 +223,6 @@ body.cms {
} }
} }
} }
.cms-content-tools {
position: relative !important; // TEMP until JS is removed
.cms-panel-content {
height: calc(100% - 53px) !important; // TEMP until JS is removed
}
// History panel
.cms-helper-hide-actions {
height: 100% !important;
}
}
} }
// History checkboxes // History checkboxes
@ -1050,7 +1038,6 @@ body.cms {
z-index: 70; z-index: 70;
box-shadow: 1px 0 0 0 $border-color-dark; box-shadow: 1px 0 0 0 $border-color-dark;
z-index: 1000; z-index: 1000;
float: left;
position: relative; position: relative;
.cms-panel-header { .cms-panel-header {
@ -1063,8 +1050,6 @@ body.cms {
.cms-panel-content { .cms-panel-content {
width: 300px; width: 300px;
overflow: auto;
height:100%;
.btn-toolbar .ss-ui-action-constructive { .btn-toolbar .ss-ui-action-constructive {
margin-right:5px; //accounts for the scrollbar in the filter - keeps the actions on one line instead of wrapping onto two. margin-right:5px; //accounts for the scrollbar in the filter - keeps the actions on one line instead of wrapping onto two.
@ -1517,9 +1502,12 @@ form.member-profile-form {
cursor: pointer; cursor: pointer;
.cms-panel-header *, .cms-panel-header *,
.cms-panel-content, .cms-panel-toggle a.toggle-collapse {
.cms-panel-toggle a.toggle-collapse{ display: none;
display:none; }
.cms-panel-content > * {
display: none;
} }
.cms-panel-toggle a.toggle-expand { .cms-panel-toggle a.toggle-expand {

View File

@ -1,4 +1,4 @@
<div id="settings-controller-cms-content" class="cms-content center cms-tabset flexbox-area-grow fill-height $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content"> <div id="settings-controller-cms-content" class="cms-content cms-tabset flexbox-area-grow fill-height $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
<div class="cms-content-header north"> <div class="cms-content-header north">
<% with $EditForm %> <% with $EditForm %>

View File

@ -1,6 +1,6 @@
<form $FormAttributes data-layout-type="border"> <form $FormAttributes data-layout-type="border">
<div class="panel panel--padded panel--scrollable panel--single-toolbar cms-content-fields"> <div class="panel panel--padded panel--scrollable flexbox-area-grow cms-content-fields">
<% if $Message %> <% if $Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p> <p id="{$FormName}_error" class="message $MessageType">$Message</p>
<% else %> <% else %>

View File

@ -1,4 +1,4 @@
<div class="cms-content center $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content"> <div class="cms-content $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content">
$Tools $Tools

View File

@ -11,7 +11,7 @@
> >
<% include SilverStripe\\Admin\\CMSLoadingScreen %> <% include SilverStripe\\Admin\\CMSLoadingScreen %>
<div class="cms-container center fill-width" data-layout-type="custom"> <div class="cms-container fill-width" data-layout-type="custom">
$Menu $Menu
$Content $Content
$PreviewPanel $PreviewPanel