From ba3f2fb2466c6fc49a3dab23658eaf8f9d882232 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 21 May 2017 18:10:55 +0200 Subject: [PATCH] Added sitename on menubar --- assets/js/common/page.js | 4 ++++ assets/js/pages/menuBar.js | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/assets/js/common/page.js b/assets/js/common/page.js index dbb8d5f7..ac38e941 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -151,6 +151,10 @@ ComunicWeb.common.page = { var pageTarget = createElem("div", mainContenerElem); pageTarget.id = "pageTarget"; } + else{ + //We can empty page target (much faster) + pageTarget.innerHTML = ""; + } //Set wrapper class pageTarget.className = "content-wrapper"; diff --git a/assets/js/pages/menuBar.js b/assets/js/pages/menuBar.js index 4d5a6f71..0bb260ac 100644 --- a/assets/js/pages/menuBar.js +++ b/assets/js/pages/menuBar.js @@ -25,7 +25,7 @@ ComunicWeb.pages.menuBar = { //So we have to initializate it //Create menubar element - var menuBar = createElem("div"); + var menuBar = createElem("header"); byId("wrapper").insertBefore(menuBar, byId("wrapper").childNodes[0]); menuBar.id = "menuBar"; @@ -36,13 +36,39 @@ ComunicWeb.pages.menuBar = { /** * Initializate a menubar * - * @param {HTMLElement} menuElem The menu container + * @param {HTMLElement} menuContainer The menu container * @return {Boolan} True for a success */ - init: function(menuElem){ + init: function(menuContainer){ //Log action - ComunicWeb.debug.logMessage("Info: Initializate a menuBar on element : '"+menuElem.id+"'"); + ComunicWeb.debug.logMessage("Info: Initializate a menuBar in element : '"+menuContainer.id+"'"); + + //Change menu container informations + menuContainer.className = "main-header"; + + //Create main menu + var menuElem = createElem("div", menuContainer); + menuElem.className = "navbar navbar-static-top"; + + //Create nav element + var navElem = createElem("nav", menuElem); + navElem.className = "navbar navbar-static-top"; + + //Create conatiner + var containerElem = createElem("div", navElem); + containerElem.className = "container"; + + //Create navbar header + var navbarHeader = createElem("div", containerElem); + navbarHeader.className = "navbar-header"; + + //Create site name link + var siteNameElem = createElem("a", navbarHeader); + siteNameElem.className = "navbar-brand"; + siteNameElem.innerText = "Comunic"; + siteNameElem.onclick = (function(){ + ComunicWeb.common.page.openPage("home"); + }); - }, }; \ No newline at end of file