Commit 99a146b5 authored by David Monllaó's avatar David Monllaó
Browse files

Merge branch 'MDL-50999-28' of git://github.com/andrewnicols/moodle into MOODLE_28_STABLE

parents b524b286 3f98ccfb
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -58,8 +58,7 @@ BLOCK.prototype = {
* @method initializer
*/
initializer : function() {
var node = Y.one('#inst'+this.get('id')),
commands;
var node = Y.one('#inst'+this.get('id'));
if (!node) {
return false;
}
......@@ -71,14 +70,7 @@ BLOCK.prototype = {
// Move the block straight to the dock if required
if (node.hasClass(CSS.dockonload)) {
node.removeClass(CSS.dockonload);
commands = node.one('.header .title .commands');
if (!commands) {
commands = Y.Node.create('<div class="commands"></div>');
if (node.one('.header .title')) {
node.one('.header .title').append(commands);
}
}
this.moveToDock(null, commands);
this.moveToDock();
}
this.skipsetposition = false;
return true;
......@@ -134,8 +126,15 @@ BLOCK.prototype = {
this.recordBlockState();
blocktitle = this.cachedcontentnode.one('.title h2').cloneNode(true);
blockcommands = this.cachedcontentnode.one('.title .commands').cloneNode(true);
// Build up the block commands.
// These should not actually added to the DOM.
blockcommands = this.cachedcontentnode.one('.title .commands');
if (blockcommands) {
blockcommands = blockcommands.cloneNode(true);
} else {
blockcommands = Y.Node.create('<div class="commands"></div>');
}
movetoimg = Y.Node.create('<img />').setAttrs({
alt : Y.Escape.html(M.str.block.undockitem),
title : Y.Escape.html(M.util.get_string('undockblock', 'block', blocktitle.get('innerHTML'))),
......@@ -186,9 +185,6 @@ BLOCK.prototype = {
node.replace(this.contentplaceholder);
dock.addToHoldingArea(node);
node = null;
if (!this.cachedcontentnode.one('.title .commands')) {
this.cachedcontentnode.one('.title').append(Y.Node.create('<div class="commands"></div>'));
}
},
/**
......@@ -197,8 +193,7 @@ BLOCK.prototype = {
* @return {Boolean}
*/
returnToPage : function() {
var id = this.get('id'),
commands;
var id = this.get('id');
Y.log('Moving block out of the dock:'+this.get('id'), 'debug', LOGNS);
......@@ -214,15 +209,8 @@ BLOCK.prototype = {
}
this.contentplaceholder.replace(this.cachedcontentnode);
this.cachedcontentnode = Y.one('#'+this.cachedcontentnode.get('id'));
commands = this.dockitem.get('commands');
if (commands) {
commands.all('.hidepanelicon').remove();
commands.all('.moveto').remove();
commands.remove();
}
this.cachedcontentnode = null;
M.util.set_user_preference('docked_block_instance_'+id, 0);
this.set('isDocked', false);
return true;
......
......@@ -425,7 +425,6 @@ DOCK.prototype = {
Y.delegate('mouseenter', this.handleEvent, this.get('dockNode'), '.'+CSS.dockedtitle, this, mouseenterargs);
this.get('dockNode').on('mouseleave', this.handleEvent, this, {cssselector:'#dock', delay:0.5, iscontained:false});
Y.delegate('click', this.handleReturnToBlock, this.get('dockNode'), SELECTOR.panelmoveto, this);
Y.delegate('click', this.handleReturnToBlock, this.get('dockNode'), SELECTOR.panelmoveto, this);
Y.delegate('dock:actionkey', this.handleDockedItemEvent, this.get('dockNode'), '.'+CSS.dockeditem, this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment