Merge branch 'MDL-50971-m29' of git://github.com/NeillM/moodle into MOODLE_29_STABLE

This commit is contained in:
David Monllao
2015-09-02 09:39:49 +08:00
13 changed files with 63 additions and 46 deletions
@@ -497,7 +497,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}, this);
@@ -744,7 +744,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server
File diff suppressed because one or more lines are too long
@@ -497,7 +497,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}, this);
@@ -744,7 +744,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server
+2 -2
View File
@@ -293,7 +293,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}, this);
@@ -540,7 +540,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server
+5
View File
@@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 2.9.2 ===
* The actionmenu hideMenu() function now expects an EventFacade object to be passed to it,
i.e. a call to M.core.actionmenu.instance.hideMenu() can be changed to M.core.actionmenu.instance.hideMenu(e) to ensure good
behaviour when using custom action menus.
=== 2.9.1 ===
* New methods grade_grade::get_grade_max() and get_grade_min() must be used rather than directly the public properties rawgrademax and rawgrademin.
@@ -247,9 +247,10 @@ ACTIONMENU.prototype = {
/**
* Hides the menu if it is visible.
* @param {EventFacade} e
* @method hideMenu
*/
hideMenu : function() {
hideMenu : function(e) {
if (this.dialogue) {
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
this.dialogue.removeClass('show');
@@ -268,7 +269,10 @@ ACTIONMENU.prototype = {
}
if (this.menulink) {
this.menulink.focus();
if (!e || e.type != 'click') {
// We needed to test !e to retain backwards compatiablity if the event is not passed.
this.menulink.focus();
}
this.menulink = null;
}
},
@@ -295,7 +299,7 @@ ACTIONMENU.prototype = {
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
this.hideMenu(e);
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
@@ -324,7 +328,7 @@ ACTIONMENU.prototype = {
this.lastMenuChild.focus();
e.preventDefault();
} else if (e.keyCode === 9 && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
}
return this;
@@ -332,7 +336,7 @@ ACTIONMENU.prototype = {
if (e.keyCode === 27) {
// The escape key was pressed so close the menu.
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.keyCode === 32) {
@@ -344,10 +348,10 @@ ACTIONMENU.prototype = {
// We only override the Shift + Tab on the first option, and Tab on the last option to change where the
// focus is moved to.
if (e.target === this.firstMenuChild && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.target === this.lastMenuChild && !e.shiftKey) {
if (this.hideMenu()) {
if (this.hideMenu(e)) {
// Determine the next selector and focus on it.
next = this.menulink.next(SELECTOR.CAN_RECEIVE_FOCUS_SELECTOR);
if (next) {
@@ -414,7 +418,7 @@ ACTIONMENU.prototype = {
*/
hideIfOutside : function(e) {
if (!e.target.ancestor(SELECTOR.MENUCHILD, true)) {
this.hideMenu();
this.hideMenu(e);
}
},
@@ -469,7 +473,7 @@ ACTIONMENU.prototype = {
if (e.currentTarget.test(SELECTOR.KEEPOPEN)) {
return;
}
this.hideMenu();
this.hideMenu(e);
}, SELECTOR.MENUCHILD, this));
return true;
File diff suppressed because one or more lines are too long
@@ -246,9 +246,10 @@ ACTIONMENU.prototype = {
/**
* Hides the menu if it is visible.
* @param {EventFacade} e
* @method hideMenu
*/
hideMenu : function() {
hideMenu : function(e) {
if (this.dialogue) {
this.dialogue.removeClass('show');
this.dialogue.one(SELECTOR.MENUCONTENT).set('aria-hidden', true);
@@ -266,7 +267,10 @@ ACTIONMENU.prototype = {
}
if (this.menulink) {
this.menulink.focus();
if (!e || e.type != 'click') {
// We needed to test !e to retain backwards compatiablity if the event is not passed.
this.menulink.focus();
}
this.menulink = null;
}
},
@@ -293,7 +297,7 @@ ACTIONMENU.prototype = {
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
this.hideMenu(e);
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
@@ -322,7 +326,7 @@ ACTIONMENU.prototype = {
this.lastMenuChild.focus();
e.preventDefault();
} else if (e.keyCode === 9 && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
}
return this;
@@ -330,7 +334,7 @@ ACTIONMENU.prototype = {
if (e.keyCode === 27) {
// The escape key was pressed so close the menu.
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.keyCode === 32) {
@@ -342,10 +346,10 @@ ACTIONMENU.prototype = {
// We only override the Shift + Tab on the first option, and Tab on the last option to change where the
// focus is moved to.
if (e.target === this.firstMenuChild && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.target === this.lastMenuChild && !e.shiftKey) {
if (this.hideMenu()) {
if (this.hideMenu(e)) {
// Determine the next selector and focus on it.
next = this.menulink.next(SELECTOR.CAN_RECEIVE_FOCUS_SELECTOR);
if (next) {
@@ -411,7 +415,7 @@ ACTIONMENU.prototype = {
*/
hideIfOutside : function(e) {
if (!e.target.ancestor(SELECTOR.MENUCHILD, true)) {
this.hideMenu();
this.hideMenu(e);
}
},
@@ -465,7 +469,7 @@ ACTIONMENU.prototype = {
if (e.currentTarget.test(SELECTOR.KEEPOPEN)) {
return;
}
this.hideMenu();
this.hideMenu(e);
}, SELECTOR.MENUCHILD, this));
return true;
+13 -9
View File
@@ -245,9 +245,10 @@ ACTIONMENU.prototype = {
/**
* Hides the menu if it is visible.
* @param {EventFacade} e
* @method hideMenu
*/
hideMenu : function() {
hideMenu : function(e) {
if (this.dialogue) {
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
this.dialogue.removeClass('show');
@@ -266,7 +267,10 @@ ACTIONMENU.prototype = {
}
if (this.menulink) {
this.menulink.focus();
if (!e || e.type != 'click') {
// We needed to test !e to retain backwards compatiablity if the event is not passed.
this.menulink.focus();
}
this.menulink = null;
}
},
@@ -293,7 +297,7 @@ ACTIONMENU.prototype = {
// Prevent event propagation as it will trigger the hideIfOutside event handler in certain situations.
e.halt(true);
this.hideMenu();
this.hideMenu(e);
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
@@ -322,7 +326,7 @@ ACTIONMENU.prototype = {
this.lastMenuChild.focus();
e.preventDefault();
} else if (e.keyCode === 9 && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
}
return this;
@@ -330,7 +334,7 @@ ACTIONMENU.prototype = {
if (e.keyCode === 27) {
// The escape key was pressed so close the menu.
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.keyCode === 32) {
@@ -342,10 +346,10 @@ ACTIONMENU.prototype = {
// We only override the Shift + Tab on the first option, and Tab on the last option to change where the
// focus is moved to.
if (e.target === this.firstMenuChild && e.shiftKey) {
this.hideMenu();
this.hideMenu(e);
e.preventDefault();
} else if (e.target === this.lastMenuChild && !e.shiftKey) {
if (this.hideMenu()) {
if (this.hideMenu(e)) {
// Determine the next selector and focus on it.
next = this.menulink.next(SELECTOR.CAN_RECEIVE_FOCUS_SELECTOR);
if (next) {
@@ -412,7 +416,7 @@ ACTIONMENU.prototype = {
*/
hideIfOutside : function(e) {
if (!e.target.ancestor(SELECTOR.MENUCHILD, true)) {
this.hideMenu();
this.hideMenu(e);
}
},
@@ -467,7 +471,7 @@ ACTIONMENU.prototype = {
if (e.currentTarget.test(SELECTOR.KEEPOPEN)) {
return;
}
this.hideMenu();
this.hideMenu(e);
}, SELECTOR.MENUCHILD, this));
return true;
@@ -399,7 +399,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}
});
@@ -441,7 +441,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server.
File diff suppressed because one or more lines are too long
@@ -399,7 +399,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}
});
@@ -441,7 +441,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server.
+2 -2
View File
@@ -177,7 +177,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
}
});
@@ -219,7 +219,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
this.send_request(data, null, function(response) {
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
M.core.actionmenu.instance.hideMenu(ev);
}
// Try to retrieve the existing string from the server.