From 6a738e60321a49cb81ef0dd57f35eff5b97f905d Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 22 May 2017 18:12:50 +0200 Subject: [PATCH] Created landing page script --- assets/js/common/functionsSchema.js | 8 +++++++- assets/js/pages/home/home.js | 14 ++++---------- assets/js/pages/home/landingPage.js | 16 ++++++++++++++++ corePage/config/dev.config.php | 1 + 4 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 assets/js/pages/home/landingPage.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index d8cc1b4a..ee8815b8 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -328,7 +328,6 @@ var ComunicWeb = { */ pages:{ - /** * Home page */ @@ -344,6 +343,13 @@ var ComunicWeb = { }, + + /** + * Landing home page + */ + landingPage:{ + //TODO : implement + } }, /** diff --git a/assets/js/pages/home/home.js b/assets/js/pages/home/home.js index 9b4589e9..1c9e7a4b 100644 --- a/assets/js/pages/home/home.js +++ b/assets/js/pages/home/home.js @@ -15,8 +15,9 @@ ComunicWeb.pages.home.home = { //Check wether if user is logged in or not var userLoggedIn = ComunicWeb.user.userLogin.getUserLoginState(); - //Dev feature : Show result + //Check if user is in or not if(userLoggedIn){ + //Dev feature : Show result targetElement.appendChild(ComunicWeb.common.messages.createCalloutElem("", "User logged in !", "info")); //Create logout button @@ -28,15 +29,8 @@ ComunicWeb.pages.home.home = { targetElement.appendChild(loginButton); } else{ - targetElement.appendChild(ComunicWeb.common.messages.createCalloutElem("", "User not logged in !", "warning")); - - //Create login button - var loginButton = document.createElement("button"); - loginButton.onclick = (function(){ - ComunicWeb.common.page.openPage("login"); - }); - loginButton.innerHTML="Login"; - targetElement.appendChild(loginButton); + //Display landing page + ComunicWeb.pages.home.landingPage.display(targetElement); } //Everything seems to be OK diff --git a/assets/js/pages/home/landingPage.js b/assets/js/pages/home/landingPage.js new file mode 100644 index 00000000..cd6dbd6e --- /dev/null +++ b/assets/js/pages/home/landingPage.js @@ -0,0 +1,16 @@ +/** + * Landing home page + * + * @author Pierre HUBERT + */ +ComunicWeb.pages.home.landingPage = { + /** + * Display home landing page + * + * @param {element} targetElement Where the page will be applied + */ + display: function(targetElement){ + //Log action + ComunicWeb.debug.logMessage("Open home landing page."); + } +}; \ No newline at end of file diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index a59b39f9..b5b71d20 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -62,6 +62,7 @@ $config['JSfiles'] = array( //Pages scripts "%PATH_ASSETS%js/pages/home/home.js", + "%PATH_ASSETS%js/pages/home/landingPage.js", "%PATH_ASSETS%js/pages/login.js", "%PATH_ASSETS%js/pages/logout.js",