MDL-41551 theme_base: improved custom block region handling for base

This commit is contained in:
Sam Hemelryk 2014-03-31 11:46:50 +13:00
parent 292dcf047f
commit 04f1a90d05
7 changed files with 52 additions and 10 deletions

View File

@ -18,7 +18,8 @@ CSS = {
SKIPBLOCK : 'skip-block',
SKIPBLOCKTO : 'skip-block-to',
MYINDEX : 'page-my-index',
REGIONMAIN : 'region-main'
REGIONMAIN : 'region-main',
BLOCKSMOVING : 'blocks-moving'
};
var SELECTOR = {
@ -166,6 +167,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
if (drag.get('node').next() && drag.get('node').next().hasClass(CSS.SKIPBLOCKTO)) {
this.skipnodebottom = drag.get('node').next();
}
// Add the blocks-moving class so that the theme can respond if need be.
Y.one('body').addClass(CSS.BLOCKSMOVING);
},
drop_over : function(e) {
@ -210,11 +214,13 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
},
drop_end : function() {
drag_end : function() {
// clear variables
this.skipnodetop = null;
this.skipnodebottom = null;
this.dragsourceregion = null;
// Remove the blocks moving class once the drag-drop is over.
Y.one('body').removeClass(CSS.BLOCKSMOVING);
},
drag_dropmiss : function(e) {

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,8 @@ CSS = {
SKIPBLOCK : 'skip-block',
SKIPBLOCKTO : 'skip-block-to',
MYINDEX : 'page-my-index',
REGIONMAIN : 'region-main'
REGIONMAIN : 'region-main',
BLOCKSMOVING : 'blocks-moving'
};
var SELECTOR = {
@ -166,6 +167,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
if (drag.get('node').next() && drag.get('node').next().hasClass(CSS.SKIPBLOCKTO)) {
this.skipnodebottom = drag.get('node').next();
}
// Add the blocks-moving class so that the theme can respond if need be.
Y.one('body').addClass(CSS.BLOCKSMOVING);
},
drop_over : function(e) {
@ -210,11 +214,13 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
},
drop_end : function() {
drag_end : function() {
// clear variables
this.skipnodetop = null;
this.skipnodebottom = null;
this.dragsourceregion = null;
// Remove the blocks moving class once the drag-drop is over.
Y.one('body').removeClass(CSS.BLOCKSMOVING);
},
drag_dropmiss : function(e) {

View File

@ -16,7 +16,8 @@ CSS = {
SKIPBLOCK : 'skip-block',
SKIPBLOCKTO : 'skip-block-to',
MYINDEX : 'page-my-index',
REGIONMAIN : 'region-main'
REGIONMAIN : 'region-main',
BLOCKSMOVING : 'blocks-moving'
};
var SELECTOR = {
@ -164,6 +165,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
if (drag.get('node').next() && drag.get('node').next().hasClass(CSS.SKIPBLOCKTO)) {
this.skipnodebottom = drag.get('node').next();
}
// Add the blocks-moving class so that the theme can respond if need be.
Y.one('body').addClass(CSS.BLOCKSMOVING);
},
drop_over : function(e) {
@ -208,11 +212,13 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
},
drop_end : function() {
drag_end : function() {
// clear variables
this.skipnodetop = null;
this.skipnodebottom = null;
this.dragsourceregion = null;
// Remove the blocks moving class once the drag-drop is over.
Y.one('body').removeClass(CSS.BLOCKSMOVING);
},
drag_dropmiss : function(e) {

View File

@ -175,5 +175,6 @@ $THEME->hidefromselector = true;
$THEME->javascripts = array();
$THEME->javascripts_footer = array();
// Set this to the method you will use in your layout files for
$THEME->blockrendermethod = 'blocks_for_region';
// Set this to the method you will use in your layout files for rendering blocks.
// It should be either blocks (default) or blocks_for_region.
$THEME->blockrendermethod = 'blocks_for_region';

View File

@ -53,6 +53,12 @@ body {margin:auto 0px;width:auto;}
.side-post-only #page-content #region-pre {width:0px;}
.has_dock.side-post-only .page-middle #region-main {margin-left:200px;}
/** Moving block when side pre only **/
.blocks-moving.side-pre-only #page-content #region-post-box {margin-left:-400px;}
.blocks-moving.side-pre-only #page-content #region-main {margin-left:400px;}
.blocks-moving.side-pre-only #page-content #region-pre {left:200px;}
.blocks-moving.side-pre-only #page-content #region-post {width:200px;}
/** Moving block when side-post-only **/
.blocks-moving.side-post-only #page-content #region-main-box {left:200px;width:200%;}
.blocks-moving.side-post-only #page-content #region-post-box {margin-left:-400px;}

View File

@ -70,4 +70,21 @@ left: 210px;
.blocks-moving.side-post-only #page-content #region-post {
width: 210px;
}
/** Moving block when side pre only **/
.blocks-moving.side-pre-only #page-content #region-post-box {
margin-left:-420px;
}
.blocks-moving.side-pre-only #page-content #region-main {
margin-left:420px;
}
.blocks-moving.side-pre-only #page-content #region-pre {
left:210px;
}
.blocks-moving.side-pre-only #page-content #region-post {
width:210px;
}