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

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


The following commit(s) were added to refs/heads/master by this push:
     new df5f9e9  Move some config items to config.js
df5f9e9 is described below

commit df5f9e9c3f8e50d0cd154ee3e24c6c2f86ed7241
Author: Sebb <[email protected]>
AuthorDate: Tue Sep 28 17:39:27 2021 +0100

    Move some config items to config.js
---
 webui/js/config.js                 |  6 +++++-
 webui/js/ponymail.js               | 16 +++++-----------
 webui/js/source/init.js            |  5 -----
 webui/js/source/list-index.js      |  3 +--
 webui/js/source/listview-header.js |  8 ++++----
 5 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/webui/js/config.js b/webui/js/config.js
index 21a0699..d32a9fb 100644
--- a/webui/js/config.js
+++ b/webui/js/config.js
@@ -51,7 +51,11 @@ var pm_config = {
     trendPie: true,
     URLBase: '',
     apiURL: '/',
-    apiSuffix: ''
+    apiSuffix: '',
+    boring_lists: ['commits', 'cvs', 'site-cvs', 'security', 'notifications'], 
// we'd rather not default to these, noisy!
+    favorite_list: 'dev', // if we have this, default to it
+    long_tabs: false, // tab name format (long or short)
+    LOTS_OF_LISTS: 25 // Beyond this number of list domains we start using the 
old phonebook.
 }
 
 
diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 92b5cd3..43613ce 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -1652,11 +1652,6 @@ var ponymail_date_format = {
 var virtual_inbox_loading = false;
 var collated_json = {};
 
-// List auto-picker criteria
-var boring_lists = ['commits', 'cvs', 'site-cvs', 'security', 
'notifications']; // we'd rather not default to these, noisy!
-var favorite_list = 'dev'; // if we have this, default to it
-var long_tabs = false; // tab name format (long or short)
-
 console.log("/******* Apache Pony Mail (Foal v/%s) Initializing 
********/".format(ponymail_version))
 // Adjust titles:
 document.title = ponymail_name;
@@ -1932,7 +1927,6 @@ function ponymail_swipe(event) {
  Fetched from source/list-index.js
 ******************************************/
 
-let LOTS_OF_LISTS = 25; // Beyond 25 list domains and we start using the old 
phonebook.
 let list_json = {}
 
 function list_index(state, json) {
@@ -2005,7 +1999,7 @@ function list_index_onepage(state, json) {
         obj.inject(['- ', a]);
         obj.inject(new HTML('br'));
     }
-    if (domains.length > LOTS_OF_LISTS) {
+    if (domains.length > pm_config.LOTS_OF_LISTS) {
         list_index(state, json);
     } else {
         let wide_obj = document.getElementById('list_index_child_wide');
@@ -2285,7 +2279,7 @@ function listview_list_lists(state, json) {
                 if (i >= maxlists) break;
                 let listname = alists[i];
                 let listnametxt = listname;
-                if (long_tabs) {
+                if (pm_config.long_tabs) {
                     listnametxt = '%s@%s'.format(listname, current_domain);
                 }
                 let li = new HTML('li', {
@@ -2410,12 +2404,12 @@ function switch_project(domain) {
         let listname = lists[0];
         let n = 1;
         if (lists.length > n) {
-            while (boring_lists.has(listname) && lists.length > n) {
+            while (pm_config.boring_lists.has(listname) && lists.length > n) {
                 listname = lists[n];
                 n++;
             }
-            if (lists.has(favorite_list)) {
-                listname = favorite_list;
+            if (lists.has(pm_config.favorite_list)) {
+                listname = pm_config.favorite_list;
             }
         }
         switch_list('%s@%s'.format(listname, domain));
diff --git a/webui/js/source/init.js b/webui/js/source/init.js
index 25963b9..a521c3f 100644
--- a/webui/js/source/init.js
+++ b/webui/js/source/init.js
@@ -48,11 +48,6 @@ var ponymail_date_format = {
 var virtual_inbox_loading = false;
 var collated_json = {};
 
-// List auto-picker criteria
-var boring_lists = ['commits', 'cvs', 'site-cvs', 'security', 
'notifications']; // we'd rather not default to these, noisy!
-var favorite_list = 'dev'; // if we have this, default to it
-var long_tabs = false; // tab name format (long or short)
-
 console.log("/******* Apache Pony Mail (Foal v/%s) Initializing 
********/".format(ponymail_version))
 // Adjust titles:
 document.title = ponymail_name;
diff --git a/webui/js/source/list-index.js b/webui/js/source/list-index.js
index 02a1af3..86698a7 100644
--- a/webui/js/source/list-index.js
+++ b/webui/js/source/list-index.js
@@ -15,7 +15,6 @@
  limitations under the License.
  */
 
-let LOTS_OF_LISTS = 25; // Beyond 25 list domains and we start using the old 
phonebook.
 let list_json = {}
 
 function list_index(state, json) {
@@ -88,7 +87,7 @@ function list_index_onepage(state, json) {
         obj.inject(['- ', a]);
         obj.inject(new HTML('br'));
     }
-    if (domains.length > LOTS_OF_LISTS) {
+    if (domains.length > pm_config.LOTS_OF_LISTS) {
         list_index(state, json);
     } else {
         let wide_obj = document.getElementById('list_index_child_wide');
diff --git a/webui/js/source/listview-header.js 
b/webui/js/source/listview-header.js
index f9131fb..6f55a00 100644
--- a/webui/js/source/listview-header.js
+++ b/webui/js/source/listview-header.js
@@ -157,7 +157,7 @@ function listview_list_lists(state, json) {
                 if (i >= maxlists) break;
                 let listname = alists[i];
                 let listnametxt = listname;
-                if (long_tabs) {
+                if (pm_config.long_tabs) {
                     listnametxt = '%s@%s'.format(listname, current_domain);
                 }
                 let li = new HTML('li', {
@@ -282,12 +282,12 @@ function switch_project(domain) {
         let listname = lists[0];
         let n = 1;
         if (lists.length > n) {
-            while (boring_lists.has(listname) && lists.length > n) {
+            while (pm_config.boring_lists.has(listname) && lists.length > n) {
                 listname = lists[n];
                 n++;
             }
-            if (lists.has(favorite_list)) {
-                listname = favorite_list;
+            if (lists.has(pm_config.favorite_list)) {
+                listname = pm_config.favorite_list;
             }
         }
         switch_list('%s@%s'.format(listname, domain));

Reply via email to