Ready to prepare user page implementation

This commit is contained in:
Pierre 2017-12-10 08:13:22 +01:00
parent 6251d47ca0
commit 7cd4348066
6 changed files with 73 additions and 42 deletions

View File

@ -643,6 +643,25 @@ var ComunicWeb = {
}
},
/**
* User page
*/
userPage: {
/**
* Main user page
*/
main: {
/**
* Open user page
*/
open: function(params, target){},
},
},
/**
* Login controller
*/

View File

@ -123,7 +123,18 @@ ComunicWeb.common.page = {
//Check if there is also subfolders
if(firstPartURI.indexOf("/") != -1){
//Save the list of subfolders
var subfoldersURIarray = firstPartURI.split("/");
subfoldersURIarray.shift();
subfoldersURI = subfoldersURIarray.join("/");
//Remove them to find the right page
firstPartURI = firstPartURI.split("/")[0];
} else {
//No subfolder was specified
subfoldersURI = false;
}
//Check if specied page exists
@ -202,6 +213,11 @@ ComunicWeb.common.page = {
//Check if some additionnal data was specified
if(!additionnalData)
additionnalData = {};
//Add the subfolder URI (if any)
if(subfoldersURI){
additionnalData.subfolder = subfoldersURI;
}
//Call the method related to the page
eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));

View File

@ -17,50 +17,10 @@ ComunicWeb.pages.home.home = {
//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
var loginButton = document.createElement("button");
loginButton.onclick = (function(){
ComunicWeb.common.page.openPage("logout");
});
loginButton.innerHTML="Logout";
targetElement.appendChild(loginButton);
//Open current user page
openPage("user/me");
//Dev feature emojies
var emojiesArea = createElem2({
appendTo: targetElement,
type: "p",
innerHTML: "Emoji test : :) 🇬🇫 🎅🏻 :( (movie) (cool)"
});
//Parse emojies
ComunicWeb.components.emoji.parser.parse({
element: emojiesArea,
});
//Create textarea element
var textarea = createFormGroup({
target: targetElement,
type: "textarea",
label: "Textarea",
placeholder: "New message",
});
textarea.style.width = "200px";
//Initializate textarea
var textarea2 = new ComunicWeb.components.textarea();
textarea2.init({
element: textarea,
minHeight: "32px",
maxHeight: "70px",
});
}
else{
//Display landing page

View File

@ -0,0 +1,24 @@
/**
* User page
*
* Display the profile of the user
*
* Main file
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.userPage.main = {
/**
* Open user page
*
* @param {Object} params Parametres required to open the page
* @param {HTMLElement} target The target for the user page
*/
open: function(params, target){
console.log(params);
}
}

View File

@ -14,6 +14,15 @@ ComunicWeb.pagesList = {
disableMenus: false,
},
/**
* User profile page
*/
user: {
pageTitle: "User Page",
methodHandler: "ComunicWeb.pages.userPage.main.open",
disableMenus: false,
},
/**
* Login page
*/

View File

@ -168,6 +168,9 @@ $config['JSfiles'] = array(
"%PATH_ASSETS%js/pages/home/home.js",
"%PATH_ASSETS%js/pages/home/landingPage.js",
//User page
"%PATH_ASSETS%js/pages/userPage/main.js",
//Login page
"%PATH_ASSETS%js/pages/login.js",