Skip to content

Commit

Permalink
Merge branch '40976-26' of git://github.com/samhemelryk/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski authored and stronk7 committed Oct 22, 2013
2 parents 3481222 + f559341 commit d425663
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
Expand Up @@ -64,7 +64,7 @@ ACTIONMENU.prototype = {
* @method initializer
*/
initializer : function() {
Y.log('Initialising action menu manager', 'note', ACTIONMENU.NAME);
Y.log('Initialising the action menu manager', 'debug', ACTIONMENU.NAME);
Y.all(SELECTOR.MENU).each(this.enhance, this);
BODY.delegate('click', this.toggleMenu, SELECTOR.MENU + ' ' + SELECTOR.TOGGLE, this);
BODY.delegate('key', this.toggleMenu, 'enter,space', SELECTOR.MENU + ' ' + SELECTOR.TOGGLE, this);
Expand Down Expand Up @@ -99,6 +99,7 @@ ACTIONMENU.prototype = {
*/
hideMenu : function() {
if (this.dialogue) {
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
this.dialogue.removeClass('show');
this.dialogue.one(SELECTOR.MENUCONTENT).set('aria-hidden', true);
this.dialogue = null;
Expand All @@ -121,11 +122,17 @@ ACTIONMENU.prototype = {
* @param {EventFacade} e
*/
toggleMenu : function(e) {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
// Stop all immediate propogation of the events we attach later will be
// triggered and the dialogue immediately hidden again.
e.halt(true);
this.hideMenu();
this.showMenu(e.target.ancestor(SELECTOR.MENU));
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
}
this.showMenu(menu);
// Close the menu if the user presses escape.
this.events.push(BODY.on('key', this.hideMenu, 'esc', this));
// Close the menu if the user clicks outside the menu.
Expand Down Expand Up @@ -154,7 +161,7 @@ ACTIONMENU.prototype = {
* @returns {M.core.dialogue|dialogue}
*/
showMenu : function(menu) {
Y.log('Displaying action menu', 'note', ACTIONMENU.NAME);
Y.log('Displaying an action menu', 'debug', ACTIONMENU.NAME);
var ownerselector = menu.getData('owner'),
menucontent = menu.one(SELECTOR.MENUCONTENT);
this.owner = (ownerselector) ? menu.ancestor(ownerselector) : null;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -120,11 +120,17 @@ ACTIONMENU.prototype = {
* @param {EventFacade} e
*/
toggleMenu : function(e) {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
// Stop all immediate propogation of the events we attach later will be
// triggered and the dialogue immediately hidden again.
e.halt(true);
this.hideMenu();
this.showMenu(e.target.ancestor(SELECTOR.MENU));
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
}
this.showMenu(menu);
// Close the menu if the user presses escape.
this.events.push(BODY.on('key', this.hideMenu, 'esc', this));
// Close the menu if the user clicks outside the menu.
Expand Down
13 changes: 10 additions & 3 deletions lib/yui/src/actionmenu/js/actionmenu.js
Expand Up @@ -62,7 +62,7 @@ ACTIONMENU.prototype = {
* @method initializer
*/
initializer : function() {
Y.log('Initialising action menu manager', 'note', ACTIONMENU.NAME);
Y.log('Initialising the action menu manager', 'debug', ACTIONMENU.NAME);
Y.all(SELECTOR.MENU).each(this.enhance, this);
BODY.delegate('click', this.toggleMenu, SELECTOR.MENU + ' ' + SELECTOR.TOGGLE, this);
BODY.delegate('key', this.toggleMenu, 'enter,space', SELECTOR.MENU + ' ' + SELECTOR.TOGGLE, this);
Expand Down Expand Up @@ -97,6 +97,7 @@ ACTIONMENU.prototype = {
*/
hideMenu : function() {
if (this.dialogue) {
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
this.dialogue.removeClass('show');
this.dialogue.one(SELECTOR.MENUCONTENT).set('aria-hidden', true);
this.dialogue = null;
Expand All @@ -119,11 +120,17 @@ ACTIONMENU.prototype = {
* @param {EventFacade} e
*/
toggleMenu : function(e) {
var menu = e.target.ancestor(SELECTOR.MENU),
menuvisible = (menu.hasClass('show'));
// Stop all immediate propogation of the events we attach later will be
// triggered and the dialogue immediately hidden again.
e.halt(true);
this.hideMenu();
this.showMenu(e.target.ancestor(SELECTOR.MENU));
if (menuvisible) {
// The menu was visible and the user has clicked to toggle it again.
return;
}
this.showMenu(menu);
// Close the menu if the user presses escape.
this.events.push(BODY.on('key', this.hideMenu, 'esc', this));
// Close the menu if the user clicks outside the menu.
Expand Down Expand Up @@ -152,7 +159,7 @@ ACTIONMENU.prototype = {
* @returns {M.core.dialogue|dialogue}
*/
showMenu : function(menu) {
Y.log('Displaying action menu', 'note', ACTIONMENU.NAME);
Y.log('Displaying an action menu', 'debug', ACTIONMENU.NAME);
var ownerselector = menu.getData('owner'),
menucontent = menu.one(SELECTOR.MENUCONTENT);
this.owner = (ownerselector) ? menu.ancestor(ownerselector) : null;
Expand Down

0 comments on commit d425663

Please sign in to comment.