Created settings sections system.

This commit is contained in:
Pierre 2018-04-13 19:00:49 +02:00
parent 991a950a42
commit 6288af5899
5 changed files with 90 additions and 0 deletions

View File

@ -1075,6 +1075,27 @@ var ComunicWeb = {
navigationPane: {
//TODO : implement
},
/**
* Settings sections list
*/
sectionsList: {
//TODO : implement
},
/**
* Settings sections script
*/
sections: {
/**
* General section
*/
general: {
//TODO : implement
},
},
},
/**

View File

@ -32,8 +32,38 @@ ComunicWeb.pages.settings.main = {
class: "col-md-3"
});
//Right area
var rightArea = createElem2({
appendTo: row,
type: "div",
class: "col-md-9"
});
//Display left navigation pane
ComunicWeb.pages.settings.navigationPane.display(leftArea);
//Determine which page to open
var section = args.subfolder ? args.subfolder : "general";
//Check if the section exists or not
if(ComunicWeb.pages.settings.sectionsList[section]){
//Extract section information
var section = ComunicWeb.pages.settings.sectionsList[section];
//Update document title
document.title += section.title;
//Call handler
eval(section.handler + "(args, rightArea);");
}
//The section is not found
else {
//Display error page (404)
ComunicWeb.common.error.pageNotFound(args, target);
}
},
}

View File

@ -0,0 +1,19 @@
/**
* Settings general section
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.settings.sections.general = {
/**
* Open settings section
*
* @param {object} args Additionnal arguments
* @param {HTMLElement} target The target for the page
*/
open: function(args, target){
alert("hey");
}
};

View File

@ -0,0 +1,17 @@
/**
* Settings pages list
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.settings.sectionsList = {
/**
* General settings
*/
general: {
title: "General",
handler: "ComunicWeb.pages.settings.sections.general.open",
},
}

View File

@ -321,6 +321,9 @@ class Dev {
//User settings page
"js/pages/settings/main.js",
"js/pages/settings/navigationPane.js",
"js/pages/settings/sectionsList.js",
//Settings sections
"js/pages/settings/sections/general.js",
//Login page
"js/pages/login.js",