mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 09:58:51 +00:00
Ready to prepare user page implementation
This commit is contained in:
parent
6251d47ca0
commit
7cd4348066
@ -643,6 +643,25 @@ var ComunicWeb = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* User page
|
||||
*/
|
||||
userPage: {
|
||||
|
||||
/**
|
||||
* Main user page
|
||||
*/
|
||||
main: {
|
||||
|
||||
/**
|
||||
* Open user page
|
||||
*/
|
||||
open: function(params, target){},
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Login controller
|
||||
*/
|
||||
|
@ -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
|
||||
@ -203,6 +214,11 @@ ComunicWeb.common.page = {
|
||||
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);"));
|
||||
|
||||
|
@ -17,49 +17,9 @@ 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);
|
||||
|
||||
|
||||
|
||||
//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",
|
||||
});
|
||||
|
||||
//Open current user page
|
||||
openPage("user/me");
|
||||
|
||||
}
|
||||
else{
|
||||
|
24
assets/js/pages/userPage/main.js
Normal file
24
assets/js/pages/userPage/main.js
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
*/
|
||||
|
@ -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",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user