MDL-43145 dock: fixed up region_completely_docked code to ignore empty regions

This commit is contained in:
Sam Hemelryk
2014-04-11 10:34:31 +08:00
committed by Andrew Nicols
parent ad5a8cd6a2
commit 34df4e4ba4
10 changed files with 25 additions and 15 deletions
+5 -1
View File
@@ -518,7 +518,11 @@ class block_manager {
$this->check_is_loaded();
$this->ensure_content_created($region, $output);
foreach($this->visibleblockcontent[$region] as $instance) {
if (!$this->region_has_content($region, $output)) {
// If the region has no content then nothing is docked at all of course.
return false;
}
foreach ($this->visibleblockcontent[$region] as $instance) {
if (!empty($instance->content) && !get_user_preferences('docked_block_instance_'.$instance->blockinstanceid, 0)) {
return false;
}
@@ -351,7 +351,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
var goodregions = Y.all('.block-region[data-blockregion]').size();
var allregions = Y.all('.block-region').size();
this._isusingnewblocksmethod = (allregions === goodregions);
if (goodregions > 0 && allregions > 0) {
if (goodregions > 0 && allregions > 0 && goodregions !== allregions) {
Y.log('Both core_renderer::blocks and core_renderer::blocks_for_region have been used.', 'warn', 'moodle-core_blocks');
}
}
@@ -494,7 +494,7 @@ MANAGER.prototype = {
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
// On the mouse down event we will enable all block regions so that they can be dragged to.
// This is VERY important as without it dnd won't work for empty block regions.
dragdelegation.on('drag:mouseDown', this.enable_all_regions, this);
dragdelegation.on('drag:start', this.enable_all_regions, this);
region.change_block_move_icons(this);
}
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -351,7 +351,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
var goodregions = Y.all('.block-region[data-blockregion]').size();
var allregions = Y.all('.block-region').size();
this._isusingnewblocksmethod = (allregions === goodregions);
if (goodregions > 0 && allregions > 0) {
if (goodregions > 0 && allregions > 0 && goodregions !== allregions) {
}
}
return this._isusingnewblocksmethod;
@@ -490,7 +490,7 @@ MANAGER.prototype = {
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
// On the mouse down event we will enable all block regions so that they can be dragged to.
// This is VERY important as without it dnd won't work for empty block regions.
dragdelegation.on('drag:mouseDown', this.enable_all_regions, this);
dragdelegation.on('drag:start', this.enable_all_regions, this);
region.change_block_move_icons(this);
}
+3 -1
View File
@@ -750,7 +750,9 @@ DOCK.prototype = {
BODY.addClass('used-region-'+regionname);
BODY.removeClass('empty-region-'+regionname);
BODY.removeClass('docked-region-'+regionname);
} else {
} else if (region.all('.block_dock_placeholder').size() > 0) {
// There are no blocks in the region but there are placeholders.
// All blocks in this region have been docked.
BODY.addClass('empty-region-'+regionname);
BODY.addClass('docked-region-'+regionname);
BODY.removeClass('used-region-'+regionname);
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -743,7 +743,9 @@ DOCK.prototype = {
BODY.addClass('used-region-'+regionname);
BODY.removeClass('empty-region-'+regionname);
BODY.removeClass('docked-region-'+regionname);
} else {
} else if (region.all('.block_dock_placeholder').size() > 0) {
// There are no blocks in the region but there are placeholders.
// All blocks in this region have been docked.
BODY.addClass('empty-region-'+regionname);
BODY.addClass('docked-region-'+regionname);
BODY.removeClass('used-region-'+regionname);
+1 -1
View File
@@ -349,7 +349,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
var goodregions = Y.all('.block-region[data-blockregion]').size();
var allregions = Y.all('.block-region').size();
this._isusingnewblocksmethod = (allregions === goodregions);
if (goodregions > 0 && allregions > 0) {
if (goodregions > 0 && allregions > 0 && goodregions !== allregions) {
Y.log('Both core_renderer::blocks and core_renderer::blocks_for_region have been used.', 'warn', 'moodle-core_blocks');
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ MANAGER.prototype = {
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
// On the mouse down event we will enable all block regions so that they can be dragged to.
// This is VERY important as without it dnd won't work for empty block regions.
dragdelegation.on('drag:mouseDown', this.enable_all_regions, this);
dragdelegation.on('drag:start', this.enable_all_regions, this);
region.change_block_move_icons(this);
}
+3 -1
View File
@@ -748,7 +748,9 @@ DOCK.prototype = {
BODY.addClass('used-region-'+regionname);
BODY.removeClass('empty-region-'+regionname);
BODY.removeClass('docked-region-'+regionname);
} else {
} else if (region.all('.block_dock_placeholder').size() > 0) {
// There are no blocks in the region but there are placeholders.
// All blocks in this region have been docked.
BODY.addClass('empty-region-'+regionname);
BODY.addClass('docked-region-'+regionname);
BODY.removeClass('used-region-'+regionname);