From 7ead57ce248459fd1223371c24d8409fa47fe57b Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 18 Feb 2017 18:37:36 +0100 Subject: [PATCH] Prepare login page --- assets/js/common/functionsSchema.js | 15 +++++++++++++++ assets/js/common/page.js | 4 ++-- assets/js/pages/home/home.js | 3 +++ assets/js/pages/login.js | 18 ++++++++++++++++++ assets/js/pagesList.js | 8 ++++++++ corePage/config/dev.config.php | 1 + 6 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 assets/js/pages/login.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 8e00e42b..f5a4b0bf 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -246,6 +246,11 @@ var ComunicWeb = { * Try to login user */ loginUser: function(usermail, userpassword, permanentLogin, afterLogin){}, + + /** + * Logout user + */ + logoutUser: function(afterLogout){}, }, /** @@ -278,5 +283,15 @@ var ComunicWeb = { }, }, + /** + * Login controller + */ + login:{ + /** + * Open login page + */ + openLoginPage: function(additionnalData, targetElement){}, + } + }, } \ No newline at end of file diff --git a/assets/js/common/page.js b/assets/js/common/page.js index aab04ed9..227f2390 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -94,11 +94,11 @@ ComunicWeb.common.page = { document.title = pageInfos.pageTitle; //Get the main contener of the page - var mainContenerElem = document.getElementById("wrapper"); + //var mainContenerElem = document.getElementById("wrapper"); //If we didn't get anything, clean the page and create a wrapper element if(!mainContenerElem){ - mainContenerElem = this.emptyPage(true); + var mainContenerElem = this.emptyPage(true); } //Check if some additionnal data was specified diff --git a/assets/js/pages/home/home.js b/assets/js/pages/home/home.js index e8738835..79c6ebe8 100644 --- a/assets/js/pages/home/home.js +++ b/assets/js/pages/home/home.js @@ -1,9 +1,12 @@ /** * Common homes functions + * + * @author Pierre HUBERT */ ComunicWeb.pages.home.home = { /** * Open home page + * * @param {Object} additionnalData Additionnal data passed in the method * @param {element} targetElement Where the template will be applied * @returns {Boolean} False if it fails diff --git a/assets/js/pages/login.js b/assets/js/pages/login.js new file mode 100644 index 00000000..d01ffece --- /dev/null +++ b/assets/js/pages/login.js @@ -0,0 +1,18 @@ +/** + * Login page controller + * + * @author Pierre HUBERT + */ + +ComunicWeb.pages.login = { + /** + * Open login page + * + * @param {Object} additionnalData Additionnal data passed in the method + * @param {element} targetElement Where the template will be applied + * @returns {Boolean} False if it fails + */ + openLoginPage: function(additionnalData, targetElement){ + alert("login page to open !"); + } +}; \ No newline at end of file diff --git a/assets/js/pagesList.js b/assets/js/pagesList.js index 50b1ca68..8e77d1e7 100644 --- a/assets/js/pagesList.js +++ b/assets/js/pagesList.js @@ -13,6 +13,14 @@ ComunicWeb.pagesList = { methodHandler: "ComunicWeb.pages.home.home.openHomePage", }, + /** + * Login page + */ + login: { + pageTitle: "Login page", + methodHandler: "ComunicWeb.pages.login.openLoginPage", + }, + /** * 404 Page not found */ diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index 06538c6d..e4d47f7f 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -49,6 +49,7 @@ $config['JSfiles'] = array( //Pages scripts "%PATH_ASSETS%js/pages/home/home.js", + "%PATH_ASSETS%js/pages/login.js", //Init script "%PATH_ASSETS%js/init.js",