MDL-36607: Improve block drag and drop

* Adding support for subpage
* Adding support for regions that do not start with "side-"
This commit is contained in:
Mark Nielsen
2012-12-10 14:12:57 +13:00
committed by Sam Hemelryk
parent 9d8abffc87
commit e893c6d442
3 changed files with 14 additions and 1 deletions
+11 -1
View File
@@ -99,7 +99,13 @@ YUI.add('moodle-core-blocks', function(Y) {
},
get_block_region : function(node) {
return node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region/i, 'side');
var region = node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region-/i, '');
if (Y.Array.indexOf(this.get('regions'), region) === -1) {
// Must be standard side-X
return 'side-' + region;
}
// Perhaps custom region
return region;
},
get_region_id : function(node) {
@@ -207,6 +213,7 @@ YUI.add('moodle-core-blocks', function(Y) {
courseid : this.get('courseid'),
pagelayout : this.get('pagelayout'),
pagetype : this.get('pagetype'),
subpage : this.get('subpage'),
action : 'move',
bui_moveid : this.get_block_id(dragnode),
bui_newregion : this.get_block_region(dropnode)
@@ -262,6 +269,9 @@ YUI.add('moodle-core-blocks', function(Y) {
pagetype : {
value : null
},
subpage : {
value : null
},
regions : {
value : null
}