From fba7937d0255ec6abbc78f536e2a11a76deaf257 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 11 Jan 2019 11:11:25 +0100 Subject: [PATCH] Splited bottom links list and rendering --- assets/js/common/functionsSchema.js | 7 ++++++ assets/js/components/bottom/links.js | 21 ++++++++++++++++++ assets/js/components/bottom/main.js | 33 +++++++++++++--------------- system/config/dev.config.php | 1 + 4 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 assets/js/components/bottom/links.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 692a2086..750de49a 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -592,6 +592,13 @@ var ComunicWeb = { */ bottom: { + /** + * Bottom links + */ + links: [ + //TODO : implement + ], + /** * Main bottom script file */ diff --git a/assets/js/components/bottom/links.js b/assets/js/components/bottom/links.js new file mode 100644 index 00000000..81589340 --- /dev/null +++ b/assets/js/components/bottom/links.js @@ -0,0 +1,21 @@ +/** + * Comunic bottom links list + * + * @author Pierre HUBERT + */ + +ComunicWeb.components.bottom.links = [ + + //Language selector + { + innerHTML: " Language", + onclick: function(){ComunicWeb.components.langPicker.show();} + }, + + //About Comunic + { + innerHTML: " About", + href: ComunicWeb.__config.aboutWebsiteURL, + target: "_blank" + } +]; \ No newline at end of file diff --git a/assets/js/components/bottom/main.js b/assets/js/components/bottom/main.js index fbc33db1..7bcee35a 100644 --- a/assets/js/components/bottom/main.js +++ b/assets/js/components/bottom/main.js @@ -43,27 +43,24 @@ ComunicWeb.components.bottom.main = { innerHTML: "Comunic     " }); - //Put the language selector link on the right - var langLink = createElem2({ - appendTo: leftElements, - type: "a", - innerHTML: " Language" - }); - langLink.onclick = function(){ - ComunicWeb.components.langPicker.show(); - }; + ComunicWeb.components.bottom.links.forEach(function(link){ - add_space(leftElements); - add_space(leftElements); + var linkEl = createElem2({ + appendTo: leftElements, + type: "a", + href: link.href, + innerHTML: link.innerHTML + }); - //Add about link - var aboutLink = createElem2({ - appendTo: leftElements, - type: "a", - innerHTML: " About", - href: ComunicWeb.__config.aboutWebsiteURL + if(link.target) + linkEl.setAttribute("target", link.target); + + if(link.onclick) + linkEl.onclick = link.onclick; + + add_space(leftElements); + add_space(leftElements); }); - aboutLink.setAttribute("target", "_blank"); } } \ No newline at end of file diff --git a/system/config/dev.config.php b/system/config/dev.config.php index e1f99906..b2194be2 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -339,6 +339,7 @@ class Dev { "js/components/menuBar/authenticated.js", //Bottom view + "js/components/bottom/links.js", "js/components/bottom/main.js", //Language picker