From f76d9ba9cd3345f3ef444af56e4729b0eb50d286 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 11 Jan 2019 11:54:22 +0100 Subject: [PATCH] Display bottom links on main menu. --- assets/js/components/bottom/links.js | 6 ++-- assets/js/components/bottom/main.js | 4 ++- assets/js/components/menuBar/authenticated.js | 28 ++++++++++++++++--- assets/js/langs/en.inc.js | 5 ++++ assets/js/langs/fr.inc.js | 4 +++ 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/assets/js/components/bottom/links.js b/assets/js/components/bottom/links.js index 81589340..71f4f7e4 100644 --- a/assets/js/components/bottom/links.js +++ b/assets/js/components/bottom/links.js @@ -8,13 +8,15 @@ ComunicWeb.components.bottom.links = [ //Language selector { - innerHTML: " Language", + innerLang: "bottom_bar_action_language", + icon: "fa-globe", onclick: function(){ComunicWeb.components.langPicker.show();} }, //About Comunic { - innerHTML: " About", + innerLang: "bottom_bar_action_about", + icon: "fa-question-circle", href: ComunicWeb.__config.aboutWebsiteURL, target: "_blank" } diff --git a/assets/js/components/bottom/main.js b/assets/js/components/bottom/main.js index 7bcee35a..7eaeb650 100644 --- a/assets/js/components/bottom/main.js +++ b/assets/js/components/bottom/main.js @@ -49,7 +49,9 @@ ComunicWeb.components.bottom.main = { appendTo: leftElements, type: "a", href: link.href, - innerHTML: link.innerHTML + innerHTML: link.innerHTML, + innerLang: link.innerLang, + innerHTMLprefix: " " }); if(link.target) diff --git a/assets/js/components/menuBar/authenticated.js b/assets/js/components/menuBar/authenticated.js index 7e74961d..4639bc7a 100644 --- a/assets/js/components/menuBar/authenticated.js +++ b/assets/js/components/menuBar/authenticated.js @@ -14,13 +14,15 @@ ComunicWeb.components.menuBar.authenticated = { //Conversations { innerLang: "menu_bar_action_conversations", - targetPage: "conversations" + targetPage: "conversations", + icon: "fa-comments-o" }, //Groups list { innerLang: "menu_bar_action_groups", targetPage: "groups", + icon: "fa-group" }, //Dark theme @@ -34,13 +36,15 @@ ComunicWeb.components.menuBar.authenticated = { //Settings list { innerLang: "menu_bar_action_settings", - targetPage: "settings" + targetPage: "settings", + icon: "fa-gear" }, //Logout link { innerLang: "_menu_bar_action_logout", - targetPage: "logout" + targetPage: "logout", + icon: "fa-sign-out" } ], @@ -120,7 +124,7 @@ ComunicWeb.components.menuBar.authenticated = { //Process links list - this.dropdownMenuLinksList.forEach(function(entry){ + var addMenuOption = function(entry){ var linkButton = createElem2({ appendTo: dropdownContent, @@ -130,6 +134,7 @@ ComunicWeb.components.menuBar.authenticated = { var link = createElem2({ appendTo: linkButton, type: "a", + href: entry.href, innerLang: entry.innerLang, innerHTML: entry.innerHTML, innerHTMLprefix: entry.icon ? " " : undefined, @@ -142,6 +147,9 @@ ComunicWeb.components.menuBar.authenticated = { }; } + if(entry.target) + link.setAttribute("target", entry.target); + if(entry.onclick){ linkButton.addEventListener("click", function(){ entry.onclick(link); @@ -151,8 +159,20 @@ ComunicWeb.components.menuBar.authenticated = { if(entry.oninit){ entry.oninit(link); } + + }; + + this.dropdownMenuLinksList.forEach(addMenuOption); + + //Add divider + createElem2({ + appendTo: dropdownContent, + type: "li", + class: "divider" }); + + ComunicWeb.components.bottom.links.forEach(addMenuOption); //Return dropdown content element diff --git a/assets/js/langs/en.inc.js b/assets/js/langs/en.inc.js index 4bf318b2..a7955c5a 100644 --- a/assets/js/langs/en.inc.js +++ b/assets/js/langs/en.inc.js @@ -57,6 +57,11 @@ ComunicWeb.common.langs.en = { menu_bar_action_settings: "Settings", _menu_bar_action_logout: "Logout", + //Bottom bar - links + bottom_bar_action_language: "Language", + bottom_bar_action_about: "About", + + //Posts - Actions posts_actions_err_get_single: "An error occured while getting information about the post !", diff --git a/assets/js/langs/fr.inc.js b/assets/js/langs/fr.inc.js index 68b0051c..3a291a78 100644 --- a/assets/js/langs/fr.inc.js +++ b/assets/js/langs/fr.inc.js @@ -58,6 +58,10 @@ ComunicWeb.common.langs.fr = { menu_bar_action_settings: "Paramètres", _menu_bar_action_logout: "Déconnexion", + //Bottom bar - links + bottom_bar_action_language: "Langue", + bottom_bar_action_about: "A propos", + //Posts - Actions posts_actions_err_get_single: "Une erreur a survenue lors de la récupération d'informations sur le post !",