Skip to content

Instantly share code, notes, and snippets.

@dimovdaniel
Created August 6, 2017 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimovdaniel/e7d9de7923f149c22b5fe0930d63823a to your computer and use it in GitHub Desktop.
Save dimovdaniel/e7d9de7923f149c22b5fe0930d63823a to your computer and use it in GitHub Desktop.
/**
* This function finds the headers for the current menu
* @param firebasePath - we will use current firebasePath to find the current menu
*/
findHeadersBasedOnPath(firebasePath){
var headers=null;
var itemFound=false;
var navigation=Config.navigation;
for(var i=0;i<navigation.length&&!itemFound;i++){
if(navigation[i].path==firebasePath&&navigation[i].tableFields){
headers=navigation[i].tableFields;
itemFound=true;
}
//Look into the sub menus
if(navigation[i].subMenus){
for(var j=0;j<navigation[i].subMenus.length;j++){
if(navigation[i].subMenus[j].path==firebasePath&&navigation[i].subMenus[j].tableFields){
headers=navigation[i].subMenus[j].tableFields;
itemFound=true;
}
}
}
}
return headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment