From 6e50fa089472080e427080df4c56319ba0377e1e Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 21 May 2017 17:55:19 +0200 Subject: [PATCH] Menubar ready to be created --- assets/js/common/functionsSchema.js | 9 +++++- assets/js/common/page.js | 6 ++-- assets/js/pages/menuBar.js | 48 +++++++++++++++++++++++++++++ corePage/config/dev.config.php | 1 + 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 assets/js/pages/menuBar.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index f0a203ce..47329393 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -301,10 +301,17 @@ var ComunicWeb = { }, /** - * Pages functions + * Pages controllers */ pages:{ + /** + * Menubar + */ + menuBar: { + //TODO: implement + }, + /** * Home page */ diff --git a/assets/js/common/page.js b/assets/js/common/page.js index bf087652..dbb8d5f7 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -153,13 +153,13 @@ ComunicWeb.common.page = { } //Set wrapper class - mainContenerElem.className = "content-wrapper"; + pageTarget.className = "content-wrapper"; //Set body class document.body.className="hold-transition skin-blue layout-top-nav"; - //We load the menu - + //We load the menubar + ComunicWeb.pages.menuBar.display(); } //Check if some additionnal data was specified diff --git a/assets/js/pages/menuBar.js b/assets/js/pages/menuBar.js new file mode 100644 index 00000000..4d5a6f71 --- /dev/null +++ b/assets/js/pages/menuBar.js @@ -0,0 +1,48 @@ +/** + * Menu bar object + * + * @author Pierre HUBERT + */ + +ComunicWeb.pages.menuBar = { + /** + * Display menu bar + * + * @return {Boolean} True for a success + */ + display: function(){ + //Log message + ComunicWeb.debug.logMessage("Display menu bar"); + + //Try to get menubar element + var menuBar = byId("menuBar"); + + //We check if the menubar is present or not on the page + if(menuBar){ + ComunicWeb.debug.logMessage("Info: The menubar is already present on the page"); + return true; + } + + //So we have to initializate it + //Create menubar element + var menuBar = createElem("div"); + byId("wrapper").insertBefore(menuBar, byId("wrapper").childNodes[0]); + menuBar.id = "menuBar"; + + //Initializate the menubar + return this.init(menuBar); + }, + + /** + * Initializate a menubar + * + * @param {HTMLElement} menuElem The menu container + * @return {Boolan} True for a success + */ + init: function(menuElem){ + //Log action + ComunicWeb.debug.logMessage("Info: Initializate a menuBar on element : '"+menuElem.id+"'"); + + + }, +}; \ No newline at end of file diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index 578496d6..a23d57c5 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -57,6 +57,7 @@ $config['JSfiles'] = array( "%PATH_ASSETS%js/user/userInfos.js", //Pages scripts + "%PATH_ASSETS%js/pages/menuBar.js", "%PATH_ASSETS%js/pages/home/home.js", "%PATH_ASSETS%js/pages/login.js", "%PATH_ASSETS%js/pages/logout.js",