From 7ff7bceca3fdbe6177df1fa310dd8436d812db4d Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 2 Jul 2018 08:07:59 +0200 Subject: [PATCH] Created groups main page --- assets/css/pages/groups/pages/main.css | 12 ++++++ assets/js/common/functionsSchema.js | 27 ++++++++++++ assets/js/components/menuBar/authenticated.js | 14 +++++++ assets/js/pages/groups/main.js | 42 +++++++++++++++++++ assets/js/pages/groups/pages/main.js | 36 ++++++++++++++++ assets/js/pagesList.js | 10 +++++ system/config/dev.config.php | 11 ++++- 7 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 assets/css/pages/groups/pages/main.css create mode 100644 assets/js/pages/groups/main.js create mode 100644 assets/js/pages/groups/pages/main.js diff --git a/assets/css/pages/groups/pages/main.css b/assets/css/pages/groups/pages/main.css new file mode 100644 index 00000000..1aeed25a --- /dev/null +++ b/assets/css/pages/groups/pages/main.css @@ -0,0 +1,12 @@ +/** + * Groups main page stylesheet + * + * @author Pierre HUBERT + */ + +.groups-main-page { + max-width: 450px; + margin: auto; + text-align: center; + padding-top: 50px; +} \ No newline at end of file diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index d9ae969c..b8a93f47 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -1167,6 +1167,33 @@ var ComunicWeb = { }, }, + /** + * Groups page + */ + groups: { + + /** + * Groups page main script + */ + main: { + //TODO : implement + }, + + /** + * Groups pages + */ + pages: { + + /** + * Main page + */ + main: { + //TODO : implement + } + + } + }, + /** * User settings page */ diff --git a/assets/js/components/menuBar/authenticated.js b/assets/js/components/menuBar/authenticated.js index efd81412..40b0e501 100644 --- a/assets/js/components/menuBar/authenticated.js +++ b/assets/js/components/menuBar/authenticated.js @@ -90,6 +90,20 @@ ComunicWeb.components.menuBar.authenticated = { openPage("conversations"); }; + //Add groups link + var groupsButton = createElem2({ + appendTo: dropdownContent, + type: "li" + }); + createElem2({ + appendTo: groupsButton, + type: "a", + innerHTML: "Groups" + }); + groupsButton.onclick = function(){ + openPage("groups"); + } + //Add settings link var settingsButton = createElem2({ appendTo: dropdownContent, diff --git a/assets/js/pages/groups/main.js b/assets/js/pages/groups/main.js new file mode 100644 index 00000000..b90bfb81 --- /dev/null +++ b/assets/js/pages/groups/main.js @@ -0,0 +1,42 @@ +/** + * Groups main script + * + * @author Pierre HUBERT + */ + +ComunicWeb.pages.groups.main = { + + /** + * Open settings page + * + * @param {object} args Optionnal arguments + * @param {HTMLElement} target The target for the page + */ + open: function(args, target){ + + //Determine which page / group should be opened + if(!args.subfolder) + var page = "main"; + + else { + + //Extract the name of the page from the URL + if(!args.subfolder.includes("/")) + var page = args.subfolder; + else { + var page = args.subfolder.split("/")[0]; + } + + } + + //Check if the main page has to be opened + if(page == "main"){ + ComunicWeb.pages.groups.pages.main.open(target); + } + + //Else the page was not found + else + ComunicWeb.common.error.pageNotFound(args, target); + } + +}; \ No newline at end of file diff --git a/assets/js/pages/groups/pages/main.js b/assets/js/pages/groups/pages/main.js new file mode 100644 index 00000000..0f0e36e0 --- /dev/null +++ b/assets/js/pages/groups/pages/main.js @@ -0,0 +1,36 @@ +/** + * Groups main page + * + * @author Pierre HUBERT + */ + +ComunicWeb.pages.groups.pages.main = { + + /** + * Open the page + * + * @param {HTMLElement} target The target for the page + */ + open: function(target){ + + //Create page container + var pageContainer = createElem2({ + appendTo: target, + type: "div", + class: "groups-main-page" + }); + + //Add a button to offer to create a group + var createGroupBtn = createElem2({ + appendTo: pageContainer, + type: "div", + class: "btn btn-primary btn-create-group", + innerHTML: "Create a group" + }); + createGroupBtn.addEventListener("click", function(e){ + openPage("groups/create"); + }); + + }, + +} \ No newline at end of file diff --git a/assets/js/pagesList.js b/assets/js/pagesList.js index 0c7b16cd..7cbd2cce 100644 --- a/assets/js/pagesList.js +++ b/assets/js/pagesList.js @@ -51,6 +51,16 @@ ComunicWeb.pagesList = { needLogin: true }, + /** + * Groups page + */ + groups: { + pageTitle: "Groups", + methodHandler: "ComunicWeb.pages.groups.main.open", + disableMenus: false, + needLogin: false + }, + /** * User settings page */ diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 3fef473e..4ec12b50 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -216,6 +216,10 @@ class Dev { "css/pages/conversations/listPane.css", "css/pages/conversations/conversation.css", + //Groups page + //Groups pages + "css/pages/groups/pages/main.css", + //Settings page //Sections sections "css/pages/settings/sections/general.css", @@ -394,7 +398,7 @@ class Dev { //Post page "js/pages/postPage/main.js", - + //Latest posts page "js/pages/latestPosts/main.js", @@ -404,6 +408,11 @@ class Dev { "js/pages/conversations/conversation.js", "js/pages/conversations/utils.js", + + //Groups page + "js/pages/groups/main.js", + "js/pages/groups/pages/main.js", + //User settings page "js/pages/settings/main.js", "js/pages/settings/navigationPane.js",