MDL-43723 Blocks drag and drop: Javascript cleanup
Declare the selector instead of repeating it several times.
This commit is contained in:
@@ -21,6 +21,10 @@ CSS = {
|
||||
REGIONMAIN : 'region-main'
|
||||
};
|
||||
|
||||
var SELECTOR = {
|
||||
DRAGHANDLE : '.' + CSS.HEADER + ' .commands .moodle-core-dragdrop-draghandle'
|
||||
};
|
||||
|
||||
/**
|
||||
* Legacy drag and drop manager.
|
||||
* This drag and drop manager is specifically designed for themes using side-pre and side-post
|
||||
@@ -101,7 +105,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
container: blockregionnode,
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
@@ -116,7 +120,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
var move = blocknode.one('a.'+CSS.EDITINGMOVE);
|
||||
if (move) {
|
||||
move.replace(this.get_drag_handle(move.getAttribute('title'), '', 'iconsmall', true));
|
||||
blocknode.one('.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle').setStyle('cursor', 'move');
|
||||
blocknode.one(SELECTOR.DRAGHANDLE).setStyle('cursor', 'move');
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
@@ -480,7 +484,7 @@ MANAGER.prototype = {
|
||||
container: region.get_droptarget(),
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
+7
-3
@@ -21,6 +21,10 @@ CSS = {
|
||||
REGIONMAIN : 'region-main'
|
||||
};
|
||||
|
||||
var SELECTOR = {
|
||||
DRAGHANDLE : '.' + CSS.HEADER + ' .commands .moodle-core-dragdrop-draghandle'
|
||||
};
|
||||
|
||||
/**
|
||||
* Legacy drag and drop manager.
|
||||
* This drag and drop manager is specifically designed for themes using side-pre and side-post
|
||||
@@ -101,7 +105,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
container: blockregionnode,
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
@@ -116,7 +120,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
var move = blocknode.one('a.'+CSS.EDITINGMOVE);
|
||||
if (move) {
|
||||
move.replace(this.get_drag_handle(move.getAttribute('title'), '', 'iconsmall', true));
|
||||
blocknode.one('.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle').setStyle('cursor', 'move');
|
||||
blocknode.one(SELECTOR.DRAGHANDLE).setStyle('cursor', 'move');
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
@@ -479,7 +483,7 @@ MANAGER.prototype = {
|
||||
container: region.get_droptarget(),
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
|
||||
Vendored
+6
-2
@@ -19,6 +19,10 @@ CSS = {
|
||||
REGIONMAIN : 'region-main'
|
||||
};
|
||||
|
||||
var SELECTOR = {
|
||||
DRAGHANDLE : '.' + CSS.HEADER + ' .commands .moodle-core-dragdrop-draghandle'
|
||||
};
|
||||
|
||||
/**
|
||||
* Legacy drag and drop manager.
|
||||
* This drag and drop manager is specifically designed for themes using side-pre and side-post
|
||||
@@ -99,7 +103,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
container: blockregionnode,
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
@@ -114,7 +118,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
var move = blocknode.one('a.'+CSS.EDITINGMOVE);
|
||||
if (move) {
|
||||
move.replace(this.get_drag_handle(move.getAttribute('title'), '', 'iconsmall', true));
|
||||
blocknode.one('.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle').setStyle('cursor', 'move');
|
||||
blocknode.one(SELECTOR.DRAGHANDLE).setStyle('cursor', 'move');
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
Vendored
+1
-1
@@ -98,7 +98,7 @@ MANAGER.prototype = {
|
||||
container: region.get_droptarget(),
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
target: true,
|
||||
handles: ['.'+CSS.HEADER+' .commands .moodle-core-dragdrop-draghandle'],
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
dragConfig: {groups: this.groups}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user