From 6288af58993fb0a142bec1550c5903e7e15ef1f0 Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 13 Apr 2018 19:00:49 +0200 Subject: [PATCH] Created settings sections system. --- assets/js/common/functionsSchema.js | 21 ++++++++++++++ assets/js/pages/settings/main.js | 30 ++++++++++++++++++++ assets/js/pages/settings/sections/general.js | 19 +++++++++++++ assets/js/pages/settings/sectionsList.js | 17 +++++++++++ system/config/dev.config.php | 3 ++ 5 files changed, 90 insertions(+) create mode 100644 assets/js/pages/settings/sections/general.js create mode 100644 assets/js/pages/settings/sectionsList.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index fe8b30e7..82a68771 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -1075,6 +1075,27 @@ var ComunicWeb = { navigationPane: { //TODO : implement }, + + /** + * Settings sections list + */ + sectionsList: { + //TODO : implement + }, + + /** + * Settings sections script + */ + sections: { + + /** + * General section + */ + general: { + //TODO : implement + }, + + }, }, /** diff --git a/assets/js/pages/settings/main.js b/assets/js/pages/settings/main.js index f97f7bbc..19b850cb 100644 --- a/assets/js/pages/settings/main.js +++ b/assets/js/pages/settings/main.js @@ -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); + } }, } \ No newline at end of file diff --git a/assets/js/pages/settings/sections/general.js b/assets/js/pages/settings/sections/general.js new file mode 100644 index 00000000..2e54dedf --- /dev/null +++ b/assets/js/pages/settings/sections/general.js @@ -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"); + } + +}; \ No newline at end of file diff --git a/assets/js/pages/settings/sectionsList.js b/assets/js/pages/settings/sectionsList.js new file mode 100644 index 00000000..8ab9d958 --- /dev/null +++ b/assets/js/pages/settings/sectionsList.js @@ -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", + }, + +} \ No newline at end of file diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 81d6764d..1ca6948b 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -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",