mirror of
https://github.com/moodle/moodle.git
synced 2025-07-23 07:11:28 +02:00
Merge branch 'MDL-36752-master' of git://git.luns.net.uk/moodle
This commit is contained in:
@@ -1471,14 +1471,20 @@ M.util.help_popups = {
|
||||
M.util.help_icon = {
|
||||
Y : null,
|
||||
instance : null,
|
||||
add : function(Y, properties) {
|
||||
this.Y = Y;
|
||||
properties.node = Y.one('#'+properties.id);
|
||||
if (properties.node) {
|
||||
properties.node.on('click', this.display, this, properties);
|
||||
initialised : false,
|
||||
setup : function(Y) {
|
||||
if (this.initialised) {
|
||||
// Exit early if we have already completed setup
|
||||
return;
|
||||
}
|
||||
this.Y = Y;
|
||||
Y.one('body').delegate('click', this.display, 'span.helplink a', this);
|
||||
this.initialised = true;
|
||||
},
|
||||
display : function(event, args) {
|
||||
add : function(Y, properties) {
|
||||
this.setup(Y);
|
||||
},
|
||||
display : function(event) {
|
||||
event.preventDefault();
|
||||
if (M.util.help_icon.instance === null) {
|
||||
var Y = M.util.help_icon.Y;
|
||||
@@ -1508,7 +1514,7 @@ M.util.help_icon = {
|
||||
// Hide the menu if the user clicks outside of its content
|
||||
boundingBox.get("ownerDocument").on("mousedown", function (event) {
|
||||
var oTarget = event.target;
|
||||
var menuButton = Y.one("#"+args.id);
|
||||
var menuButton = this.helplink;
|
||||
|
||||
if (!oTarget.compareTo(menuButton) &&
|
||||
!menuButton.contains(oTarget) &&
|
||||
@@ -1525,28 +1531,24 @@ M.util.help_icon = {
|
||||
this.overlay.hide();
|
||||
},
|
||||
|
||||
display : function(event, args) {
|
||||
if (Y.one('html').get('dir') == 'rtl') {
|
||||
var overlayPosition = [Y.WidgetPositionAlign.TR, Y.WidgetPositionAlign.LC];
|
||||
display : function(event) {
|
||||
var overlayPosition;
|
||||
this.helplink = event.target.ancestor('span.helplink a', true);
|
||||
if (Y.one('html').get('dir') === 'rtl') {
|
||||
overlayPosition = [Y.WidgetPositionAlign.TR, Y.WidgetPositionAlign.LC];
|
||||
} else {
|
||||
var overlayPosition = [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.RC];
|
||||
overlayPosition = [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.RC];
|
||||
}
|
||||
|
||||
this.helplink = args.node;
|
||||
|
||||
this.overlay.set('bodyContent', Y.Node.create('<img src="'+M.cfg.loadingicon+'" class="spinner" />'));
|
||||
this.overlay.set("align", {node:args.node, points: overlayPosition});
|
||||
|
||||
var fullurl = args.url;
|
||||
if (!args.url.match(/https?:\/\//)) {
|
||||
fullurl = M.cfg.wwwroot + args.url;
|
||||
}
|
||||
|
||||
var ajaxurl = fullurl + '&ajax=1';
|
||||
this.overlay.set("align", {node:this.helplink, points: overlayPosition});
|
||||
|
||||
var cfg = {
|
||||
method: 'get',
|
||||
context : this,
|
||||
data : {
|
||||
ajax : 1
|
||||
},
|
||||
on: {
|
||||
success: function(id, o, node) {
|
||||
this.display_callback(o.responseText);
|
||||
@@ -1561,7 +1563,7 @@ M.util.help_icon = {
|
||||
}
|
||||
};
|
||||
|
||||
Y.io(ajaxurl, cfg);
|
||||
Y.io(this.helplink.get('href'), cfg);
|
||||
this.overlay.show();
|
||||
},
|
||||
|
||||
@@ -1577,10 +1579,10 @@ M.util.help_icon = {
|
||||
};
|
||||
help_content_overlay.init();
|
||||
M.util.help_icon.instance = help_content_overlay;
|
||||
M.util.help_icon.instance.display(event, args);
|
||||
M.util.help_icon.instance.display(event);
|
||||
});
|
||||
} else {
|
||||
M.util.help_icon.instance.display(event, args);
|
||||
M.util.help_icon.instance.display(event);
|
||||
}
|
||||
},
|
||||
init : function(Y) {
|
||||
|
Reference in New Issue
Block a user