mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-26 10:58:49 +00:00
Created dropdown menu for authenticated users
This commit is contained in:
parent
f80c2aca0e
commit
cf4ff4675d
@ -3,6 +3,10 @@
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* ComunicWeb main object
|
||||
*/
|
||||
var ComunicWeb = {
|
||||
|
||||
/**
|
||||
@ -336,7 +340,14 @@ var ComunicWeb = {
|
||||
*/
|
||||
notAuthenticated: {
|
||||
//TODO : implement
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Menubar for authenticated users complements
|
||||
*/
|
||||
authenticated:{
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
5
assets/js/common/shorcuts.js
Normal file
5
assets/js/common/shorcuts.js
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This file contains shorcuts to ease access of common functions
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
56
assets/js/components/menuBar/authenticated.js
Normal file
56
assets/js/components/menuBar/authenticated.js
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Menubar for authenticated users complements
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.menuBar.authenticated = {
|
||||
/**
|
||||
* Add authenticated user specific elements
|
||||
*
|
||||
* @param {HTMLElement} container The container element of the Menubar
|
||||
*/
|
||||
addElements: function(container){
|
||||
//Create an auto-collapsed element
|
||||
var navbarCollapse = createElem("div", container);
|
||||
navbarCollapse.id = "navbar-collapse";
|
||||
navbarCollapse.className = "navbar-collapse pull-right collapse";
|
||||
|
||||
//Create navbar elements list
|
||||
var navbarElemList = createElem("ul", navbarCollapse);
|
||||
navbarElemList.className = "nav navbar-nav";
|
||||
|
||||
//Add dropdown menu
|
||||
this.addDropdown(navbarElemList);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add dropdown menu
|
||||
*
|
||||
* @param {HTMLElement} navbarElem The target navbarlist element
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
addDropdown: function(navbarElem){
|
||||
//Create dropdown menu
|
||||
var dropdown = createElem("li", navbarElem);
|
||||
dropdown.className = "dropdown";
|
||||
|
||||
//Add dropdown button
|
||||
var dropdownButton = createElem("a", dropdown);
|
||||
dropdownButton.className = "dropdown-toggle";
|
||||
dropdownButton.setAttribute("data-toggle", "dropdown");
|
||||
dropdownButton.innerHTML = "Menu";
|
||||
|
||||
//Create dropdown menu content
|
||||
var dropdownContent = createElem("ul", dropdown);
|
||||
dropdownContent.className = "dropdown-menu"
|
||||
dropdownContent.setAttribute("role", "menu");
|
||||
|
||||
//Add logout link
|
||||
var logoutButton = createElem("li", dropdownContent);
|
||||
var logoutButtonLink = createElem("a", logoutButton);
|
||||
logoutButtonLink.innerHTML = "Logout";
|
||||
logoutButton.onclick
|
||||
}
|
||||
};
|
@ -99,10 +99,11 @@ ComunicWeb.components.menuBar.common = {
|
||||
|
||||
//Call specific menu
|
||||
if(userLoggedIn){
|
||||
//Not implemented yet
|
||||
//Call authenticated menubar
|
||||
ComunicWeb.components.menuBar.authenticated.addElements(containerElem);
|
||||
}
|
||||
else{
|
||||
//Call not-logged-in menu
|
||||
//Call not-logged-in menubar
|
||||
ComunicWeb.components.menuBar.notAuthenticated.addElements(containerElem);
|
||||
}
|
||||
},
|
||||
|
@ -61,6 +61,7 @@ $config['JSfiles'] = array(
|
||||
"%PATH_ASSETS%js/components/mailCaching.js",
|
||||
"%PATH_ASSETS%js/components/menuBar/common.js",
|
||||
"%PATH_ASSETS%js/components/menuBar/notAuthenticated.js",
|
||||
"%PATH_ASSETS%js/components/menuBar/authenticated.js",
|
||||
|
||||
//User scripts
|
||||
"%PATH_ASSETS%js/user/loginTokens.js",
|
||||
|
Loading…
Reference in New Issue
Block a user