Revert "Revert "Merge branch 'master' of https://github.com/driftyco/ionic""

This reverts commit 4a6086c1f8e756b86460697f685af0c8f81e3019.
This commit is contained in:
perry
2016-07-18 19:40:03 -05:00
parent 4a6086c1f8
commit 4f52135c13
86 changed files with 5592 additions and 3938 deletions

View File

@ -125,6 +125,10 @@ export class MenuController {
open(menuId?: string): Promise<boolean> {
let menu = this.get(menuId);
if (menu) {
let openedMenu = this.getOpen();
if (openedMenu && menu !== openedMenu) {
openedMenu.setOpen(false, false);
}
return menu.open();
}
@ -147,7 +151,7 @@ export class MenuController {
} else {
// find the menu that is open
menu = this._menus.find(m => m.isOpen);
menu = this.getOpen();
}
if (menu) {
@ -158,11 +162,6 @@ export class MenuController {
return Promise.resolve(false);
}
tempDisable(temporarilyDisable: boolean) {
this._menus.forEach(menu => {
menu.tempDisable(temporarilyDisable);
});
}
/**
* Toggle the menu. If it's closed, it will open, and if opened, it
@ -173,6 +172,10 @@ export class MenuController {
toggle(menuId?: string): Promise<boolean> {
let menu = this.get(menuId);
if (menu) {
let openedMenu = this.getOpen();
if (openedMenu && menu !== openedMenu) {
openedMenu.setOpen(false, false);
}
return menu.toggle();
}
return Promise.resolve(false);
@ -229,7 +232,7 @@ export class MenuController {
* provided, then it'll try to find the menu using the menu's `id`
* property. If a menu is not found then it'll return `null`.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Menu} Returns the instance of the menu if found, otherwise `null`.
* @return {Menu} Returns the instance of the menu if found, otherwise `null`.
*/
get(menuId?: string): Menu {
var menu: Menu;
@ -252,12 +255,21 @@ export class MenuController {
// return the first enabled menu
menu = this._menus.find(m => m.enabled);
if (menu) return menu;
if (menu) {
return menu;
}
// get the first menu in the array, if one exists
return (this._menus.length ? this._menus[0] : null);
}
/**
* @return {Menu} Returns the instance of the menu already opened, otherwise `null`.
*/
getOpen(): Menu {
return this._menus.find(m => m.isOpen);
}
/**
* @return {Array<Menu>} Returns an array of all menu instances.