Pages will be able to welcome a menu

This commit is contained in:
Pierre 2017-05-21 17:42:04 +02:00
parent 6ecd49d1b0
commit 7b6163328a
3 changed files with 32 additions and 10 deletions

View File

@ -124,22 +124,41 @@ ComunicWeb.common.page = {
ComunicWeb.common.url.changeURI(document.title, pageURI); ComunicWeb.common.url.changeURI(document.title, pageURI);
//Get the main contener of the page //Get the main contener of the page
var mainContenerElem = document.getElementById("wrapper"); var mainContenerElem =byId("wrapper");
//If we didn't get anything, clean the page and create a wrapper element //If we didn't get anything, clean the page and create a wrapper element
if(!mainContenerElem){ if(!mainContenerElem){
var mainContenerElem = this.emptyPage(true); var mainContenerElem = this.emptyPage(true);
} }
//We check if the page is a full screen page //We check if the page is a full screen page or not
if(pageInfos.disableMenus){ if(pageInfos.disableMenus){
//We force the screen to be cleaned //We force the screen to be cleaned
var mainContenerElem = this.emptyPage(true); var mainContenerElem = this.emptyPage(true);
var pageTarget = mainContenerElem; var pageTarget = mainContenerElem; //The page directly goes to the main target
} }
//Else //Else
else { else {
//We try to locate menubar
//We try to locate the target of the page
var pageTarget = byId("pageTarget");
//We empty screen if we couldn't rich it
if(!pageTarget){
mainContenerElem.innerHTML = "";
//We create the pagetTarget element
var pageTarget = createElem("div", mainContenerElem);
pageTarget.id = "pageTarget";
}
//Set wrapper class
mainContenerElem.className = "content-wrapper";
//Set body class
document.body.className="hold-transition skin-blue layout-top-nav";
//We load the menu
} }

View File

@ -12,13 +12,13 @@
* @return {HTMLElement} The newly created element * @return {HTMLElement} The newly created element
*/ */
function createElem(nodeType, appendTo){ function createElem(nodeType, appendTo){
var newElem = document.createElement(nodeType); var newElem = document.createElement(nodeType);
if(appendTo) if(appendTo)
appendTo.appendChild(newElem); appendTo.appendChild(newElem);
//Return result //Return result
return newElem; return newElem;
} }
/** /**
@ -28,5 +28,5 @@ function createElem(nodeType, appendTo){
* @return {HTMLElement} The elemnt / False for a failure * @return {HTMLElement} The elemnt / False for a failure
*/ */
function byId(nodeName){ function byId(nodeName){
return document.getElementById(nodeName); return document.getElementById(nodeName);
} }

View File

@ -30,6 +30,9 @@ $config['JSfiles'] = array(
"%PATH_ASSETS%adminLTE/plugins/jquery-ui/jquery-ui.min.js", "%PATH_ASSETS%adminLTE/plugins/jquery-ui/jquery-ui.min.js",
"%PATH_ASSETS%adminLTE/plugins/iCheck/icheck.min.js", "%PATH_ASSETS%adminLTE/plugins/iCheck/icheck.min.js",
//Utilities
"%PATH_ASSETS%js/common/utils.js",
//Functions schema //Functions schema
"%PATH_ASSETS%js/common/functionsSchema.js", "%PATH_ASSETS%js/common/functionsSchema.js",