This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 2a3e0f2e8c5f650f1a2bfacbfa134f58ce20d289
Author: Daniel Gruno <[email protected]>
AuthorDate: Thu Oct 28 23:18:49 2021 +0200

    Add a subscribe button option, default to not showing it
---
 webui/css/scaffolding.css        | 14 ++++++++++++++
 webui/js/config.js               |  1 +
 webui/js/ponymail.js             | 11 +++++++++++
 webui/js/source/sidebar-stats.js | 11 +++++++++++
 webui/list.html                  |  1 +
 5 files changed, 38 insertions(+)

diff --git a/webui/css/scaffolding.css b/webui/css/scaffolding.css
index 635a08d..af5a82c 100644
--- a/webui/css/scaffolding.css
+++ b/webui/css/scaffolding.css
@@ -360,6 +360,20 @@ a.dropdown-toggle {
 }
 
 
+/* Sidebar subscribe link */
+#subscribe_button {
+    margin-top: 16px;
+    display: inline-block;
+    background-color: #337ab7;
+    color: white;
+    font-size: 1.15rem;
+    text-decoration: none;
+    cursor: pointer;
+    padding: 5px;
+    border: 1px solid #0009;
+    border-radius: 4px;
+}
+
 /* Sidebar calendar */
 
 #sidebar_calendar {
diff --git a/webui/js/config.js b/webui/js/config.js
index b57289c..79dce88 100644
--- a/webui/js/config.js
+++ b/webui/js/config.js
@@ -62,6 +62,7 @@ var pm_config = {
 
 // Localized preferences (defaults)
 var prefs = {
+    subscribeLinks: false,           // Add subscribe button in stats pane?
     displayMode: 'threaded',        // threaded or flat
     groupBy: 'thread',              // thread or date
     sortOrder: 'forward',           // forward or reverse sort
diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 518baec..54b0368 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -4199,4 +4199,15 @@ async function sidebar_stats(json) {
             wordCloud(json.cloud, 220, 100, wc);
         }, 50);
     }
+
+    // Subscribe button
+    if (prefs && prefs.subscribeLinks) {
+        let sb = document.getElementById('sidebar_subscribe');
+        if (sb && json.list) {
+            sb.textContent = "";
+            let sublink = json.list.replace("@", "-subscribe@");
+            let subbutton = new HTML("a", {href: `mailto:${sublink}`, id: 
"subscribe_button"}, "Subscribe to list");
+            sb.inject(subbutton);
+        }
+    }
 }
\ No newline at end of file
diff --git a/webui/js/source/sidebar-stats.js b/webui/js/source/sidebar-stats.js
index 89fb945..31dcb06 100644
--- a/webui/js/source/sidebar-stats.js
+++ b/webui/js/source/sidebar-stats.js
@@ -67,4 +67,15 @@ async function sidebar_stats(json) {
             wordCloud(json.cloud, 220, 100, wc);
         }, 50);
     }
+
+    // Subscribe button
+    if (prefs && prefs.subscribeLinks) {
+        let sb = document.getElementById('sidebar_subscribe');
+        if (sb && json.list) {
+            sb.textContent = "";
+            let sublink = json.list.replace("@", "-subscribe@");
+            let subbutton = new HTML("a", {href: `mailto:${sublink}`, id: 
"subscribe_button"}, "Subscribe to list");
+            sb.inject(subbutton);
+        }
+    }
 }
\ No newline at end of file
diff --git a/webui/list.html b/webui/list.html
index 70e229c..fda5a8f 100644
--- a/webui/list.html
+++ b/webui/list.html
@@ -145,6 +145,7 @@ the License. -->
         <div id="sidebar_calendar"></div>
         <div id="sidebar_stats"></div>
         <div id="sidebar_wordcloud"></div>
+        <div id="sidebar_subscribe"></div>
       </div>
       
       <!--

Reply via email to