Display bottom links on main menu.

This commit is contained in:
Pierre HUBERT 2019-01-11 11:54:22 +01:00
parent dc7fd44b67
commit f76d9ba9cd
5 changed files with 40 additions and 7 deletions

View File

@ -8,13 +8,15 @@ ComunicWeb.components.bottom.links = [
//Language selector //Language selector
{ {
innerHTML: "<i class='fa fa-globe'></i> Language", innerLang: "bottom_bar_action_language",
icon: "fa-globe",
onclick: function(){ComunicWeb.components.langPicker.show();} onclick: function(){ComunicWeb.components.langPicker.show();}
}, },
//About Comunic //About Comunic
{ {
innerHTML: "<i class='fa fa-question-circle'></i> About", innerLang: "bottom_bar_action_about",
icon: "fa-question-circle",
href: ComunicWeb.__config.aboutWebsiteURL, href: ComunicWeb.__config.aboutWebsiteURL,
target: "_blank" target: "_blank"
} }

View File

@ -49,7 +49,9 @@ ComunicWeb.components.bottom.main = {
appendTo: leftElements, appendTo: leftElements,
type: "a", type: "a",
href: link.href, href: link.href,
innerHTML: link.innerHTML innerHTML: link.innerHTML,
innerLang: link.innerLang,
innerHTMLprefix: "<i class='fa "+link.icon+"'></i> "
}); });
if(link.target) if(link.target)

View File

@ -14,13 +14,15 @@ ComunicWeb.components.menuBar.authenticated = {
//Conversations //Conversations
{ {
innerLang: "menu_bar_action_conversations", innerLang: "menu_bar_action_conversations",
targetPage: "conversations" targetPage: "conversations",
icon: "fa-comments-o"
}, },
//Groups list //Groups list
{ {
innerLang: "menu_bar_action_groups", innerLang: "menu_bar_action_groups",
targetPage: "groups", targetPage: "groups",
icon: "fa-group"
}, },
//Dark theme //Dark theme
@ -34,13 +36,15 @@ ComunicWeb.components.menuBar.authenticated = {
//Settings list //Settings list
{ {
innerLang: "menu_bar_action_settings", innerLang: "menu_bar_action_settings",
targetPage: "settings" targetPage: "settings",
icon: "fa-gear"
}, },
//Logout link //Logout link
{ {
innerLang: "_menu_bar_action_logout", innerLang: "_menu_bar_action_logout",
targetPage: "logout" targetPage: "logout",
icon: "fa-sign-out"
} }
], ],
@ -120,7 +124,7 @@ ComunicWeb.components.menuBar.authenticated = {
//Process links list //Process links list
this.dropdownMenuLinksList.forEach(function(entry){ var addMenuOption = function(entry){
var linkButton = createElem2({ var linkButton = createElem2({
appendTo: dropdownContent, appendTo: dropdownContent,
@ -130,6 +134,7 @@ ComunicWeb.components.menuBar.authenticated = {
var link = createElem2({ var link = createElem2({
appendTo: linkButton, appendTo: linkButton,
type: "a", type: "a",
href: entry.href,
innerLang: entry.innerLang, innerLang: entry.innerLang,
innerHTML: entry.innerHTML, innerHTML: entry.innerHTML,
innerHTMLprefix: entry.icon ? "<i class='fa " + entry.icon + "'></i> " : undefined, innerHTMLprefix: entry.icon ? "<i class='fa " + entry.icon + "'></i> " : undefined,
@ -142,6 +147,9 @@ ComunicWeb.components.menuBar.authenticated = {
}; };
} }
if(entry.target)
link.setAttribute("target", entry.target);
if(entry.onclick){ if(entry.onclick){
linkButton.addEventListener("click", function(){ linkButton.addEventListener("click", function(){
entry.onclick(link); entry.onclick(link);
@ -151,8 +159,20 @@ ComunicWeb.components.menuBar.authenticated = {
if(entry.oninit){ if(entry.oninit){
entry.oninit(link); 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 //Return dropdown content element

View File

@ -57,6 +57,11 @@ ComunicWeb.common.langs.en = {
menu_bar_action_settings: "Settings", menu_bar_action_settings: "Settings",
_menu_bar_action_logout: "Logout", _menu_bar_action_logout: "Logout",
//Bottom bar - links
bottom_bar_action_language: "Language",
bottom_bar_action_about: "About",
//Posts - Actions //Posts - Actions
posts_actions_err_get_single: "An error occured while getting information about the post !", posts_actions_err_get_single: "An error occured while getting information about the post !",

View File

@ -58,6 +58,10 @@ ComunicWeb.common.langs.fr = {
menu_bar_action_settings: "Param&egrave;tres", menu_bar_action_settings: "Param&egrave;tres",
_menu_bar_action_logout: "Déconnexion", _menu_bar_action_logout: "Déconnexion",
//Bottom bar - links
bottom_bar_action_language: "Langue",
bottom_bar_action_about: "A propos",
//Posts - Actions //Posts - Actions
posts_actions_err_get_single: "Une erreur a survenue lors de la r&eacute;cup&eacute;ration d'informations sur le post !", posts_actions_err_get_single: "Une erreur a survenue lors de la r&eacute;cup&eacute;ration d'informations sur le post !",