From ceaf5edc8bc937c952604168f0c49d1669f430b1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 20 Feb 2021 11:13:42 +0100 Subject: [PATCH] Add link to Android application --- assets/js/components/bottom/links.js | 10 ++++- assets/js/components/bottom/main.js | 37 ++++++++++--------- assets/js/components/menuBar/authenticated.js | 2 +- assets/js/typings/ServerConfig.d.ts | 3 ++ 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/assets/js/components/bottom/links.js b/assets/js/components/bottom/links.js index e4b53afe..2e9df3c7 100644 --- a/assets/js/components/bottom/links.js +++ b/assets/js/components/bottom/links.js @@ -4,7 +4,7 @@ * @author Pierre HUBERT */ -const BottomLinks = [ +const BottomLinks = () => [ //Language selector { @@ -13,6 +13,14 @@ const BottomLinks = [ onclick: function(){ComunicWeb.components.langPicker.show();} }, + // Android application + { + innerHTML: tr("Android app"), + icon: "fa-android", + href: ServerConfig.conf.play_store_url, + target: "_blank" + }, + //About Comunic { innerLang: "bottom_bar_action_about", diff --git a/assets/js/components/bottom/main.js b/assets/js/components/bottom/main.js index a6bf6f71..c1a14d57 100644 --- a/assets/js/components/bottom/main.js +++ b/assets/js/components/bottom/main.js @@ -43,26 +43,27 @@ ComunicWeb.components.bottom.main = { innerHTML: "Comunic     " }); - BottomLinks.forEach(function(link){ + if(!signed_in()) + BottomLinks().forEach(function(link){ - var linkEl = createElem2({ - appendTo: leftElements, - type: "a", - href: link.href, - innerHTML: link.innerHTML, - innerLang: link.innerLang, - innerHTMLprefix: " " + var linkEl = createElem2({ + appendTo: leftElements, + type: "a", + href: link.href, + innerHTML: link.innerHTML, + innerLang: link.innerLang, + innerHTMLprefix: " " + }); + + if(link.target) + linkEl.setAttribute("target", link.target); + + if(link.onclick) + linkEl.onclick = link.onclick; + + add_space(leftElements); + add_space(leftElements); }); - - if(link.target) - linkEl.setAttribute("target", link.target); - - if(link.onclick) - linkEl.onclick = link.onclick; - - add_space(leftElements); - add_space(leftElements); - }); } } \ No newline at end of file diff --git a/assets/js/components/menuBar/authenticated.js b/assets/js/components/menuBar/authenticated.js index 3523dd93..7bf34c4d 100644 --- a/assets/js/components/menuBar/authenticated.js +++ b/assets/js/components/menuBar/authenticated.js @@ -197,7 +197,7 @@ ComunicWeb.components.menuBar.authenticated = { class: "divider" }); - BottomLinks.forEach(addMenuOption); + BottomLinks().forEach(addMenuOption); //Return dropdown content element diff --git a/assets/js/typings/ServerConfig.d.ts b/assets/js/typings/ServerConfig.d.ts index 27ff7331..a2acbb9a 100644 --- a/assets/js/typings/ServerConfig.d.ts +++ b/assets/js/typings/ServerConfig.d.ts @@ -25,6 +25,9 @@ declare interface DataConservationPolicySettings { } declare interface StaticServerConfig { + terms_url: string, + play_store_url: string, + android_direct_download_url: string, password_policy: PasswordPolicy, data_conservation_policy: DataConservationPolicySettings; } \ No newline at end of file