You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/08 18:59:28 UTC

[incubator-ponymail-foal] 01/02: Fix attachment elements

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 9d0c099cdcfd19c8db834d9df1bee4bc19c6c322
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 20:57:46 2020 +0200

    Fix attachment elements
    
    - Fix URL and bytesize
    - Tweak CSS properties
---
 webui/css/scaffolding.css       | 4 ++--
 webui/js/ponymail.js            | 6 +++---
 webui/js/source/render-email.js | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/webui/css/scaffolding.css b/webui/css/scaffolding.css
index bef6a3c..25a9ee6 100644
--- a/webui/css/scaffolding.css
+++ b/webui/css/scaffolding.css
@@ -888,12 +888,12 @@ a .listview_email_threaded {
 }
 
 .email_key {
-  width: 10%;
   min-width: 90px;
-  max-width: 140px;
+  max-width: 150px;
   font-weight: bold;
   float: left;
   padding-left: 5px;
+  padding-right: 5px;
 }
 
 .email_value {
diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index d76a5cb..8824a9b 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -2846,14 +2846,14 @@ async function render_email_chatty(state, json) {
     // Attachments?
     if (json.attachments && json.attachments.length > 0) {
         let attach_field = new HTML('div', {class: 'email_kv'});
-        let attach_key = new HTML('div', {class: 'email_key'}, "Attachment(s): ");
+        let attach_key = new HTML('div', {class: 'email_key'}, "Attachment(s):   ");
         let alinks = [];
         for (let n = 0; n < json.attachments.length; n++) {
             let attachment = json.attachments[n];
-            let link = `${apiURL}/api/email.lua?attachment=true&id=${json.mid}&file=${attachment.hash}`;
+            let link = `${pm_config.apiURL}api/email.lua?attachment=true&id=${json.mid}&file=${attachment.hash}`;
             let a = new HTML('a', {href: link, target: '_blank'}, attachment.filename);
             alinks.push(a);
-            let fs = " ${attachment.size} bytes";
+            let fs = ` ${attachment.size} bytes`;
             if (attachment.size >= 1024) fs = ` ${Math.floor(attachment.size/1024)} KB`;
             if (attachment.size >= 1024*1024) fs = ` ${Math.floor(attachment.size/(1024*10.24))/100} MB`;
             alinks.push (fs);
diff --git a/webui/js/source/render-email.js b/webui/js/source/render-email.js
index fe34da3..05f88b5 100644
--- a/webui/js/source/render-email.js
+++ b/webui/js/source/render-email.js
@@ -137,14 +137,14 @@ async function render_email_chatty(state, json) {
     // Attachments?
     if (json.attachments && json.attachments.length > 0) {
         let attach_field = new HTML('div', {class: 'email_kv'});
-        let attach_key = new HTML('div', {class: 'email_key'}, "Attachment(s): ");
+        let attach_key = new HTML('div', {class: 'email_key'}, "Attachment(s):");
         let alinks = [];
         for (let n = 0; n < json.attachments.length; n++) {
             let attachment = json.attachments[n];
-            let link = `${apiURL}/api/email.lua?attachment=true&id=${json.mid}&file=${attachment.hash}`;
+            let link = `${pm_config.apiURL}api/email.lua?attachment=true&id=${json.mid}&file=${attachment.hash}`;
             let a = new HTML('a', {href: link, target: '_blank'}, attachment.filename);
             alinks.push(a);
-            let fs = " ${attachment.size} bytes";
+            let fs = ` ${attachment.size} bytes`;
             if (attachment.size >= 1024) fs = ` ${Math.floor(attachment.size/1024)} KB`;
             if (attachment.size >= 1024*1024) fs = ` ${Math.floor(attachment.size/(1024*10.24))/100} MB`;
             alinks.push (fs);