Merge branch 'MDL-33890-master-2' of git://git.luns.net.uk/moodle

This commit is contained in:
Dan Poltawski 2012-07-09 10:02:13 +08:00
commit 8081238453

View File

@ -8,7 +8,6 @@ YUI.add('moodle-core-blocks', function(Y) {
EDITINGMOVE : 'editing_move',
HEADER : 'header',
LIGHTBOX : 'lightbox',
PAGECONTENT : 'page-content',
REGIONCONTENT : 'region-content',
SKIPBLOCK : 'skip-block',
SKIPBLOCKTO : 'skip-block-to'
@ -28,7 +27,8 @@ YUI.add('moodle-core-blocks', function(Y) {
this.parentnodeclass = CSS.REGIONCONTENT;
// Initialise blocks dragging
var blockregionlist = Y.Node.all('#'+CSS.PAGECONTENT+' div.'+CSS.BLOCKREGION);
// Find all block regions on the page
var blockregionlist = Y.Node.all('div.'+CSS.BLOCKREGION);
if (blockregionlist.size() === 0) {
return false;
@ -84,9 +84,6 @@ YUI.add('moodle-core-blocks', function(Y) {
}).plug(Y.Plugin.DDProxy, {
// Don't move the node at the end of the drag
moveOnEnd: false
}).plug(Y.Plugin.DDConstrained, {
// Keep it inside the .course-content
constrain: '#'+CSS.PAGECONTENT
}).plug(Y.Plugin.DDWinScroll);
}
}, this);
@ -139,6 +136,10 @@ YUI.add('moodle-core-blocks', function(Y) {
return false;
}
// TODO: Hiding-displaying block region only works for base theme blocks
// (region-pre, region-post) at the moment. It should be improved
// to work with custom block regions as well.
// TODO: Fix this for the case when user drag block towards empty section,
// then the section appears, then user chnages his mind and moving back to
// original section. The opposite section remains opened and empty.
@ -151,9 +152,9 @@ YUI.add('moodle-core-blocks', function(Y) {
}
// Moving from empty region-content towards the opposite one,
// hide empty one
// hide empty one (only for region-pre, region-post areas at the moment).
regionname = this.get_region_id(drop.ancestor('div.'+CSS.BLOCKREGION));
if (this.dragsourceregion.all('.'+CSS.BLOCK).size() == 0) {
if (this.dragsourceregion.all('.'+CSS.BLOCK).size() == 0 && this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) {
if (!documentbody.hasClass('side-'+regionname+'-only')) {
documentbody.addClass('side-'+regionname+'-only');
}