From 3020abc4bff82e980267e7c0b3504322b670d08c Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 24 May 2017 14:31:56 +0200 Subject: [PATCH] Split menubar elements in multiple parts --- assets/js/common/functionsSchema.js | 15 ++++++++++++++- assets/js/common/page.js | 2 +- .../components/{menuBar.js => menuBar/common.js} | 15 ++++++++++++--- assets/js/components/menuBar/notAuthenticated.js | 16 ++++++++++++++++ assets/js/pages/home/landingPage.js | 2 +- corePage/config/dev.config.php | 3 ++- 6 files changed, 46 insertions(+), 7 deletions(-) rename assets/js/components/{menuBar.js => menuBar/common.js} (84%) create mode 100644 assets/js/components/menuBar/notAuthenticated.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index ee8815b8..b76c9e66 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -318,7 +318,20 @@ var ComunicWeb = { * Menubar */ menuBar: { - //TODO: implement + + /** + * Menu bar object - common methods + */ + common:{ + //TODO : implement + }, + + /** + * Not authenticated menu bar components + */ + notAuthenticated: { + //TODO : implement + } }, }, diff --git a/assets/js/common/page.js b/assets/js/common/page.js index 7132cfd0..7fafcd5a 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -172,7 +172,7 @@ ComunicWeb.common.page = { document.body.className="hold-transition skin-blue layout-top-nav"; //We load the menubar - ComunicWeb.components.menuBar.display(); + ComunicWeb.components.menuBar.common.display(); } //Check if some additionnal data was specified diff --git a/assets/js/components/menuBar.js b/assets/js/components/menuBar/common.js similarity index 84% rename from assets/js/components/menuBar.js rename to assets/js/components/menuBar/common.js index f6d896e5..75b7803f 100644 --- a/assets/js/components/menuBar.js +++ b/assets/js/components/menuBar/common.js @@ -1,10 +1,10 @@ /** - * Menu bar object + * Menu bar object - common methods * * @author Pierre HUBERT */ -ComunicWeb.components.menuBar = { +ComunicWeb.components.menuBar.common = { /** * Display menu bar * @@ -71,6 +71,15 @@ ComunicWeb.components.menuBar = { }); //Now we need to know if user is logged in or not - + var userLoggedIn = ComunicWeb.user.userLogin.getUserLoginState(); + + //Call specific menu + if(userLoggedIn){ + //Not implemented yet + } + else{ + //Call not-logged-in menu + ComunicWeb.components.menuBar.notAuthenticated.addElements(containerElem); + } }, }; \ No newline at end of file diff --git a/assets/js/components/menuBar/notAuthenticated.js b/assets/js/components/menuBar/notAuthenticated.js new file mode 100644 index 00000000..1764409c --- /dev/null +++ b/assets/js/components/menuBar/notAuthenticated.js @@ -0,0 +1,16 @@ +/** + * Not authenticated menu bar components + * + * @author Pierre HUBERT + */ + +ComunicWeb.components.menuBar.notAuthenticated = { + /** + * Add not-authenticated user specific elements + * + * @param {HTMLElement} addElements The container element of the Menubar + */ + addElements: function(addElements){ + + } +} \ No newline at end of file diff --git a/assets/js/pages/home/landingPage.js b/assets/js/pages/home/landingPage.js index 53fbdd4e..cadd0a02 100644 --- a/assets/js/pages/home/landingPage.js +++ b/assets/js/pages/home/landingPage.js @@ -18,7 +18,7 @@ ComunicWeb.pages.home.landingPage = { //Preparing next actions var afterParsingTemplate = function(){ - console.log(byId("homeLandingScreen")); + //Change home background byId("homeLandingScreen").style.backgroundImage = "url('"+ComunicWeb.__config.assetsURL + "img/pages/home/landingPage/img_background.jpg')"; }; diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index b5b71d20..bb7cef41 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -53,7 +53,8 @@ $config['JSfiles'] = array( "%PATH_ASSETS%js/common/system.js", //Components - "%PATH_ASSETS%js/components/menuBar.js", + "%PATH_ASSETS%js/components/menuBar/common.js", + "%PATH_ASSETS%js/components/menuBar/notAuthenticated.js", //User scripts "%PATH_ASSETS%js/user/loginTokens.js",