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 2016/09/05 07:01:23 UTC

[1/6] incubator-ponymail git commit: more scaffolding

Repository: incubator-ponymail
Updated Branches:
  refs/heads/coffee-and-cake 2cdd4bbf7 -> 44100e943


more scaffolding


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/54bc964b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/54bc964b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/54bc964b

Branch: refs/heads/coffee-and-cake
Commit: 54bc964b130018f3bda495041d4925f0f5fde3af
Parents: 2cdd4bb
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 08:59:17 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 08:59:17 2016 +0200

----------------------------------------------------------------------
 site/css/ponymail2.css | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/54bc964b/site/css/ponymail2.css
----------------------------------------------------------------------
diff --git a/site/css/ponymail2.css b/site/css/ponymail2.css
index fb11cd0..7143356 100644
--- a/site/css/ponymail2.css
+++ b/site/css/ponymail2.css
@@ -298,7 +298,7 @@ h3, h2, h1 {
     background: #FFF;
 }
 
-.listview_item img.gravatar {
+.listview_item div img.gravatar {
     vertical-align: middle;
     margin-right: 8px;
     float: left;
@@ -306,7 +306,7 @@ h3, h2, h1 {
     margin-bottom: 4px;
 }
 
-.listview_item div:not(.listview_right) {
+.listview_item .listview_summary div:not(.listview_right) {
     margin-right: 10px;
     padding-top: 4px;
     width: 150px;
@@ -316,12 +316,12 @@ h3, h2, h1 {
     text-overflow: ellipsis;
 }
 
-.listview_item div:nth-child(2) {
+.listview_item .listview_summary div:nth-child(2) {
     padding-top: 10px;
 }
 
-.listview_item div:nth-child(3) {
-    width: calc(100% - 380px);
+.listview_item  .listview_summary div:nth-child(3) {
+    width: calc(100% - 390px);
 }
 
 .listview_right {
@@ -392,3 +392,29 @@ h3, h2, h1 {
 a {
     color: #248;
 }
+
+.listview_item .email_placeholder {
+    width: 100% !important;
+    float: left;
+}
+
+/* Email placeholder */
+.email_placeholder {
+    border: 1px inset #333;
+    padding: 10px;
+    width: 100%;
+    float: left;
+    display: block;
+}
+
+.header_key {
+    padding-top: 0px;
+    width: 80px;
+    float: left;
+    font-weight: bold;
+}
+.header_value {
+    padding-top: 0px;
+    width: calc(100% - 90px);
+    float: left;
+}
\ No newline at end of file


[6/6] incubator-ponymail git commit: regen JS

Posted by hu...@apache.org.
regen JS


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/44100e94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/44100e94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/44100e94

Branch: refs/heads/coffee-and-cake
Commit: 44100e943fff6ceff1f2c04ae7728f93d6d9a59b
Parents: 59a16d6
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 09:01:07 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 09:01:07 2016 +0200

----------------------------------------------------------------------
 site/js/ponymail-coffee.js | 247 ++++++++++++++++++++++++++++++++--------
 1 file changed, 199 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/44100e94/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index ebbd78e..0a7249f 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -1,5 +1,5 @@
 // Generated by CoffeeScript 1.9.3
-var BasicListView, Calendar, HTML, HTTPRequest, calendar_months, cog, dbRead, dbWrite, dealWithKeyboard, e, genColors, get, hasRead, hsl2rgb, isArray, isHash, listView, listviewScaffolding, markRead, maxLists, parseURL, pendingURLStatus, pending_spinner_at, pending_url_operations, pm_snap, pm_storage_available, pm_storage_globvar, ponymail_current_listview, ponymail_domain, ponymail_email_open, ponymail_list, ponymail_list_json, ponymail_listname, ponymail_lists, ponymail_month, ponymail_query, ponymail_version, readEmail, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleYear, txt;
+var BasicEmailDisplay, BasicListView, Calendar, HTML, HTTPRequest, calendar_months, cog, dbRead, dbWrite, dealWithKeyboard, e, genColors, get, hasRead, hsl2rgb, isArray, isHash, listView, listviewScaffolding, markRead, maxLists, parseURL, pendingURLStatus, pending_spinner_at, pending_url_operations, pm_snap, pm_storage_available, pm_storage_globvar, ponymail_current_email, ponymail_current_listview, ponymail_domain, ponymail_email_open, ponymail_list, ponymail_list_json, ponymail_listname, ponymail_lists, ponymail_month, ponymail_query, ponymail_stored_email, ponymail_version, readEmail, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleYear, txt;
 
 calendar_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
 
@@ -293,7 +293,11 @@ ponymail_list_json = {};
 
 ponymail_current_listview = null;
 
-ponymail_email_open = false;
+ponymail_email_open = [];
+
+ponymail_current_email = null;
+
+ponymail_stored_email = {};
 
 
 /*
@@ -525,6 +529,169 @@ cog = function(div, size) {
  */
 
 
+/* readMail: figure out how to display an email/thread */
+
+readEmail = function(obj) {
+
+  /* find the original email ID and point of origin */
+  var closedOne, email, j, len, mid, parent;
+  mid = null;
+  parent = null;
+  if (typeof obj === 'string') {
+    mid = obj;
+    parent = document.body;
+  } else if (typeof obj === 'object') {
+    mid = obj.getAttribute("data");
+    parent = obj;
+  }
+
+  /* We good to go? */
+  if ((!mid) || (!parent)) {
+    alert("Couldn't find the email or insertion point!");
+    return;
+  }
+
+  /* First check if the MID is already open
+   * If so, close it instead
+   */
+  closedOne = false;
+  for (j = 0, len = ponymail_email_open.length; j < len; j++) {
+    email = ponymail_email_open[j];
+    if (mid === email.mid) {
+      email.hide();
+      closedOne = true;
+    }
+  }
+  if (!closedOne) {
+
+    /* We have an(other) email open now */
+    ponymail_current_email = new BasicEmailDisplay(parent, mid);
+    return ponymail_email_open.push(ponymail_current_email);
+  }
+};
+
+BasicEmailDisplay = (function() {
+  function BasicEmailDisplay(parent1, mid1) {
+    var me, r;
+    this.parent = parent1;
+    this.mid = mid1;
+    this.placeholder = get("placeholder_" + this.mid) || new HTML('div', {
+      "class": "email_placeholder",
+      id: "placeholder_" + this.mid
+    });
+
+    /* Inject into listview or body */
+    this.parent.inject(this.placeholder);
+
+    /* Make sure it's empty, may have been used before! */
+    this.placeholder = this.placeholder.empty();
+    this.placeholder.show(true);
+    me = this;
+
+    /* Do we have this email in cache? */
+    if (ponymail_stored_email[this.mid]) {
+      this.render(ponymail_stored_email[this.mid]);
+    } else {
+
+      /* Not stored, fetch the email first */
+      r = new HTTPRequest("api/email.lua?", {
+        get: {
+          id: this.mid
+        },
+        callback: function(json, state) {
+          return me.render(json, state);
+        }
+      });
+    }
+  }
+
+  BasicEmailDisplay.prototype.render = function(json, state) {
+
+    /* Store email in cache if not there already */
+    var b, date_line, from_line, headers, list_line, subject_line;
+    if (!ponymail_stored_email[this.mid]) {
+      ponymail_stored_email[this.mid] = json;
+    }
+
+    /* Display email headers */
+    headers = new HTML('div');
+    from_line = new HTML('div', {}, [
+      new HTML('div', {
+        "class": "header_key"
+      }, "From: "), new HTML('div', {
+        "class": "header_value"
+      }, json.from)
+    ]);
+    headers.inject(from_line);
+    subject_line = new HTML('div', {}, [
+      new HTML('div', {
+        "class": "header_key"
+      }, "Subject: "), new HTML('div', {
+        "class": "header_value"
+      }, json.subject)
+    ]);
+    headers.inject(subject_line);
+    date_line = new HTML('div', {}, [
+      new HTML('div', {
+        "class": "header_key"
+      }, "Date: "), new HTML('div', {
+        "class": "header_value"
+      }, new Date(json.epoch * 1000).ISOBare())
+    ]);
+    headers.inject(date_line);
+
+    /* <a.b.c> -> a@b.c */
+    this.list = json.list_raw.replace(/<([^.]+)\.(.+)>/, (function(_this) {
+      return function(a, b, c) {
+        return b + "@" + c;
+      };
+    })(this));
+    list_line = new HTML('div', {}, [
+      new HTML('div', {
+        "class": "header_key"
+      }, "List: "), new HTML('div', {
+        "class": "header_value"
+      }, new HTML('a', {
+        href: "list.html?" + this.list
+      }, this.list))
+    ]);
+    headers.inject(list_line);
+    this.placeholder.inject(headers);
+
+    /* Now inject the body */
+    b = new HTML('pre', {}, json.body);
+    return this.placeholder.inject(b);
+  };
+
+  BasicEmailDisplay.prototype.hide = function() {
+    this.placeholder.show(false);
+    ponymail_email_open.remove(this);
+    return ponymail_current_email = null;
+  };
+
+  return BasicEmailDisplay;
+
+})();
+
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+
 /**
  * Pending URLs watcher:
  * Wathes which URLs have been pending a result for a while
@@ -792,43 +959,32 @@ pm_snap = null;
 /* dealWithKeyboard: Handles what happens when you hit the escape key */
 
 dealWithKeyboard = function(e) {
-  var dp, i, j, kiddos, len, splash, thread, tid;
+  var dp, email, j, len, splash;
   splash = get('splash');
 
   /* escape key: hide composer/settings/thread */
   if (e.keyCode === 27) {
     if (splash && splash.style.display === 'block') {
       splash.style.display = "none";
-    } else if (location.href.search(/list\.html/) !== -1) {
+    } else if (location.href.search(/list\d?\.html/) !== -1) {
 
       /* should only work for the list view */
 
       /* If datepicker popup is shown, hide it on escape */
-      tid = (current_thread || "").toString().replace(/@<.+>/, "");
-      thread = get('thread_' + tid) || get('thread_treeview_' + tid);
-
-      /* minimize datepicker if shown */
       dp = get('datepicker_popup');
       if (dp && dp.style.display === "block") {
         dp.show(false);
-      } else if (thread) {
+      } else if (ponymail_email_open.length > 0) {
 
-        /* Otherwise, collapse a thread ?? */
-        if (thread.style.display === 'block') {
-          if (prefs.displayMode === 'treeview') {
-            toggleEmails_threaded(current_thread, true);
-            toggleEmails_treeview(current_thread, true);
-          } else {
-            toggleEmails_threaded(current_thread, true);
-          }
+        /* Close the currently open email? */
+        if (ponymail_current_email) {
+          ponymail_current_email.hide();
         } else {
 
-          /* Close all threads? */
-          kiddos = [];
-          traverseThread(document.body, '(thread|helper)_', 'DIV');
-          for (j = 0, len = kiddos.length; j < len; j++) {
-            i = kiddos[j];
-            kiddos[i].style.display = 'none';
+          /* Close all email ? */
+          for (j = 0, len = ponymail_email_open.length; j < len; j++) {
+            email = ponymail_email_open[j];
+            email.hide();
           }
         }
       }
@@ -848,7 +1004,7 @@ dealWithKeyboard = function(e) {
     } else if (e.keyCode === 82) {
 
       /* R key: reply */
-      if (openEmail() && last_opened_email) {
+      if (ponymail_current_email && ponymail_email_open.length > 0) {
         compose(last_opened_email, null, 'reply');
       }
     } else if (e.keyCode === 83) {
@@ -1184,7 +1340,7 @@ BasicListView = (function() {
             fontWeight: readStyle
           },
           href: "thread.html/" + thread.tid,
-          onclick: "readEmail(this.parentNode.parentNode); return false;"
+          onclick: "readEmail(this.parentNode.parentNode.parentNode); return false;"
         }, original.subject), new HTML('br'), new HTML('span', {
           "class": "listview_item_body"
         }, thread.body)
@@ -1225,7 +1381,9 @@ BasicListView = (function() {
         id: uid,
         data: thread.tid,
         "class": "listview_item"
-      }, [avatar, sender, subject, date, stats]);
+      }, new HTML('div', {
+        "class": "listview_summary"
+      }, [avatar, sender, subject, date, stats]));
       return item;
     }
   };
@@ -1517,28 +1675,6 @@ markRead = function(mid) {
   return true;
 };
 
-readEmail = function(obj) {
-  var insertPoint, mailDiv, mid;
-  mid = null;
-  insertPoint = null;
-
-  /* Did we get this from a div? if so, find out things */
-  if (typeof obj === 'object') {
-    mid = obj.getAttribute("data");
-    insertPoint = obj;
-  } else if (typeof obj === 'string') {
-    mid = obj;
-    insertPoint = new HTML('div');
-    document.body.inject(insertPoint);
-  }
-  if (mid && insertPoint) {
-    markRead(mid);
-    mailDiv = new HTML('div');
-    insertPoint.inject(mailDiv);
-    return mailDiv.inject("foo bar baz!");
-  }
-};
-
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1615,6 +1751,21 @@ isHash = function(value) {
 };
 
 
+/* Remove an array element by value */
+
+Array.prototype.remove = function(val) {
+  var i, item, j, len;
+  for (i = j = 0, len = this.length; j < len; i = ++j) {
+    item = this[i];
+    if (item === val) {
+      this.splice(i, 1);
+      return this;
+    }
+  }
+  return this;
+};
+
+
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with


[3/6] incubator-ponymail git commit: add a remove-by-value func for arrays

Posted by hu...@apache.org.
add a remove-by-value func for arrays


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/794d93ec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/794d93ec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/794d93ec

Branch: refs/heads/coffee-and-cake
Commit: 794d93ec2a75405372bb768833970711ec3f2e31
Parents: 5feeaef
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 09:00:12 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 09:00:12 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/misc.coffee | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/794d93ec/site/js/coffee/misc.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
index 4fb4044..3bbcbc0 100644
--- a/site/js/coffee/misc.coffee
+++ b/site/js/coffee/misc.coffee
@@ -63,3 +63,12 @@ isHash = (value) ->
     value and
         typeof value is 'object' and
         not isArray(value)
+
+### Remove an array element by value ###
+Array.prototype.remove = (val) ->
+    for item, i in this
+        if item == val
+            this.splice(i, 1)
+            return this
+    return this;
+


[4/6] incubator-ponymail git commit: start work on an actual email display class

Posted by hu...@apache.org.
start work on an actual email display class

this just displays the original email, not the thread...yet


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/cbf6aa4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/cbf6aa4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/cbf6aa4d

Branch: refs/heads/coffee-and-cake
Commit: cbf6aa4d36121471b54c5b5032b73635a3039cbd
Parents: 794d93e
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 09:00:41 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 09:00:41 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/email_display_basic.coffee | 128 +++++++++++++++++++++++++
 site/js/coffee/mailview_basic.coffee      |  17 ----
 2 files changed, 128 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/cbf6aa4d/site/js/coffee/email_display_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/email_display_basic.coffee b/site/js/coffee/email_display_basic.coffee
new file mode 100644
index 0000000..b6fdb4e
--- /dev/null
+++ b/site/js/coffee/email_display_basic.coffee
@@ -0,0 +1,128 @@
+###
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+###
+
+### readMail: figure out how to display an email/thread ###
+readEmail = (obj) ->
+    ### find the original email ID and point of origin ###
+    mid = null
+    parent = null
+    if typeof obj is 'string'
+        mid = obj
+        parent = document.body
+    else if typeof obj is 'object'
+        mid = obj.getAttribute("data")
+        parent = obj
+
+    ### We good to go? ###
+    if (not mid) or (not parent)
+        alert("Couldn't find the email or insertion point!")
+        return
+    
+    ### First check if the MID is already open
+    # If so, close it instead ###
+    closedOne = false
+    for email in ponymail_email_open
+        if mid == email.mid
+            email.hide()
+            closedOne = true
+            
+    if not closedOne
+        ### We have an(other) email open now ###
+        ponymail_current_email = new BasicEmailDisplay(parent, mid)
+        ponymail_email_open.push(ponymail_current_email)
+
+    
+class BasicEmailDisplay
+    constructor: (@parent, @mid) ->
+        @placeholder = get("placeholder_" + @mid) || new HTML('div', { class: "email_placeholder", id: "placeholder_" + @mid})
+        
+        
+        ### Inject into listview or body ###
+        @parent.inject(@placeholder)
+        
+        ### Make sure it's empty, may have been used before! ###
+        @placeholder = @placeholder.empty()
+        @placeholder.show(true)
+        
+        me = this
+        
+        ### Do we have this email in cache? ###
+        if ponymail_stored_email[@mid]
+            @render(ponymail_stored_email[@mid])
+        else
+            ### Not stored, fetch the email first ###
+            r = new HTTPRequest("api/email.lua?", {
+                get: {
+                    id: @mid
+                }
+                callback: (json, state) ->
+                    me.render(json, state)
+            })
+        
+    render: (json, state) ->
+        
+        ### Store email in cache if not there already ###
+        if not ponymail_stored_email[@mid]
+            ponymail_stored_email[@mid] = json
+            
+        ### Display email headers ###
+        headers = new HTML('div')
+        
+        from_line = new HTML('div', {},
+            [
+                new HTML('div', {class:"header_key"}, "From: ")
+                new HTML('div', {class:"header_value"}, json.from)
+            ])
+        headers.inject(from_line)
+        
+        subject_line = new HTML('div', {},
+            [
+                new HTML('div', {class:"header_key"}, "Subject: ")
+                new HTML('div', {class:"header_value"}, json.subject)
+            ])
+        headers.inject(subject_line)
+        
+        date_line = new HTML('div', {},
+            [
+                new HTML('div', {class:"header_key"}, "Date: ")
+                new HTML('div', {class:"header_value"}, new Date(json.epoch*1000).ISOBare())
+            ])
+        headers.inject(date_line)
+        
+        ### <a.b.c> -> a@b.c ###
+        @list = json.list_raw.replace(/<([^.]+)\.(.+)>/, (a,b,c) => "#{b}@#{c}")
+        list_line = new HTML('div', {},
+            [
+                new HTML('div', {class:"header_key"}, "List: ")
+                new HTML('div', {class:"header_value"},
+                         new HTML('a', { href: "list.html?#{@list}"}, @list)
+                        )
+            ])
+        headers.inject(list_line)
+        
+        @placeholder.inject(headers)
+        
+        ### Now inject the body ###
+        b = new HTML('pre', {}, json.body)
+        @placeholder.inject(b)
+        
+        
+    hide: () ->
+        @placeholder.show(false)
+        ponymail_email_open.remove(this)
+        ponymail_current_email = null
+        
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/cbf6aa4d/site/js/coffee/mailview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/mailview_basic.coffee b/site/js/coffee/mailview_basic.coffee
deleted file mode 100644
index 42fe98a..0000000
--- a/site/js/coffee/mailview_basic.coffee
+++ /dev/null
@@ -1,17 +0,0 @@
-readEmail = (obj) ->
-    mid = null
-    insertPoint = null
-    ### Did we get this from a div? if so, find out things ###
-    if typeof obj is 'object'
-        mid = obj.getAttribute("data")
-        insertPoint = obj
-    else if typeof obj is 'string'
-        mid = obj
-        insertPoint = new HTML('div')
-        document.body.inject(insertPoint)
-    if mid and insertPoint
-        markRead(mid)
-        mailDiv = new HTML('div')
-        insertPoint.inject(mailDiv)
-        mailDiv.inject("foo bar baz!")
-        
\ No newline at end of file


[2/6] incubator-ponymail git commit: fix up keyboard shortcuts to actually work

Posted by hu...@apache.org.
fix up keyboard shortcuts to actually work


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5feeaef7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5feeaef7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5feeaef7

Branch: refs/heads/coffee-and-cake
Commit: 5feeaef7e7cf15c0499a586f6160cad551b55942
Parents: 54bc964
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 08:59:39 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 08:59:39 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/defaults.coffee           |  4 +++-
 site/js/coffee/keyboard_shortcuts.coffee | 30 +++++++++------------------
 2 files changed, 13 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5feeaef7/site/js/coffee/defaults.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/defaults.coffee b/site/js/coffee/defaults.coffee
index 55d1cbc..79ceedc 100644
--- a/site/js/coffee/defaults.coffee
+++ b/site/js/coffee/defaults.coffee
@@ -28,4 +28,6 @@ ponymail_domain = ""
 ponymail_list_json = {}
 
 ponymail_current_listview = null # Current listview class
-ponymail_email_open = false # Is the user viewing an email right now? (disable scrolling then)
\ No newline at end of file
+ponymail_email_open = [] # Is the user viewing an email right now? (disable scrolling then)
+ponymail_current_email = null # if more than one email is open, this points to the last one opened
+ponymail_stored_email = {} # Hash containing stored JSON objects of email already fetched
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5feeaef7/site/js/coffee/keyboard_shortcuts.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/keyboard_shortcuts.coffee b/site/js/coffee/keyboard_shortcuts.coffee
index f65f5ef..ca7a0ad 100644
--- a/site/js/coffee/keyboard_shortcuts.coffee
+++ b/site/js/coffee/keyboard_shortcuts.coffee
@@ -25,33 +25,23 @@ dealWithKeyboard = (e) ->
         if (splash and splash.style.display == 'block')
             splash.style.display = "none"
             #saveDraft()
-        else if (location.href.search(/list\.html/) != -1)
+        else if (location.href.search(/list\d?\.html/) != -1)
             ### should only work for the list view ###
             
             ### If datepicker popup is shown, hide it on escape ###
-            tid = (current_thread||"").toString().replace(/@<.+>/, "")
-            thread = get('thread_' + tid) || get('thread_treeview_' + tid)
-
-            ### minimize datepicker if shown ###
             dp = get('datepicker_popup')
             if dp and dp.style.display == "block"
                 dp.show(false)
             
-            else if thread
-                ### Otherwise, collapse a thread ?? ###
-                if (thread.style.display == 'block')
-                    if (prefs.displayMode == 'treeview')
-                        toggleEmails_threaded(current_thread, true)
-                        toggleEmails_treeview(current_thread, true)
-                    else
-                        toggleEmails_threaded(current_thread, true)
-                    
+            else if ponymail_email_open.length > 0
+                ### Close the currently open email? ###
+                if ponymail_current_email
+                    ponymail_current_email.hide()
                 else
-                    ### Close all threads? ###
-                    kiddos = []
-                    traverseThread(document.body, '(thread|helper)_', 'DIV')
-                    for i in kiddos
-                        kiddos[i].style.display = 'none';
+                    ### Close all email ? ###
+                    for email in ponymail_email_open
+                        email.hide()
+
                     
                     
     ### Make sure the below shortcuts don't interfere with normal operations ###
@@ -75,7 +65,7 @@ dealWithKeyboard = (e) ->
             compose(null, ponymail_list, 'new')
         else if e.keyCode == 82
             ### R key: reply ###
-            if (openEmail() && last_opened_email)
+            if (ponymail_current_email && ponymail_email_open.length > 0)
                 compose(last_opened_email, null, 'reply')
         else if e.keyCode == 83
             ### S key: quick search ###


[5/6] incubator-ponymail git commit: prep listview for displaying email inline

Posted by hu...@apache.org.
prep listview for displaying email inline


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/59a16d61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/59a16d61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/59a16d61

Branch: refs/heads/coffee-and-cake
Commit: 59a16d6104bafcdfb2561cb8dd47c4f2cfbe2b6f
Parents: cbf6aa4
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 09:01:00 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 09:01:00 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview_basic.coffee | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/59a16d61/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index 8a27d80..adce8ee 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -210,7 +210,7 @@ class BasicListView
                 
             ### Subject, PLUS a bit of the body with a break before ###
             subject = new HTML('div', {}, [
-                new HTML('a', { style: {fontWeight: readStyle}, href: "thread.html/#{thread.tid}", onclick: "readEmail(this.parentNode.parentNode); return false;"}, original.subject),
+                new HTML('a', { style: {fontWeight: readStyle}, href: "thread.html/#{thread.tid}", onclick: "readEmail(this.parentNode.parentNode.parentNode); return false;"}, original.subject),
                 new HTML('br'),
                 new HTML('span', {class: "listview_item_body"}, thread.body)
             ])
@@ -233,7 +233,9 @@ class BasicListView
             
             
             ### Finally, pull it all together in a div and add that to the listview ###
-            item = new HTML('div', {id: uid, data: thread.tid, class: "listview_item"}, [avatar, sender, subject, date, stats])
+            item = new HTML('div', {id: uid, data: thread.tid, class: "listview_item"},
+                            new HTML('div', {class:"listview_summary"}, [avatar, sender, subject, date, stats])
+                            )
             return item
         
     ### swipe: go to next or previous page of emails, depending on mouse wheel direction ###