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/04 07:23:33 UTC

[01/11] incubator-ponymail git commit: CSS tweaks + highlight currently selected month

Repository: incubator-ponymail
Updated Branches:
  refs/heads/coffee-and-cake ebb64dc40 -> 6f91ffad2


CSS tweaks + highlight currently selected month

resize the calendar a bit
highlight the month currently viewed


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

Branch: refs/heads/coffee-and-cake
Commit: ccf73acf56f9f55ef06352df6f7d7f2f326d4ec1
Parents: ebb64dc
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:37:33 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:37:33 2016 +0200

----------------------------------------------------------------------
 site/css/ponymail2.css         | 21 +++++++++++++++++----
 site/js/coffee/calendar.coffee | 20 ++++++++++++++++----
 site/js/coffee/listview.coffee |  2 +-
 3 files changed, 34 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ccf73acf/site/css/ponymail2.css
----------------------------------------------------------------------
diff --git a/site/css/ponymail2.css b/site/css/ponymail2.css
index 5160ef4..13acda1 100644
--- a/site/css/ponymail2.css
+++ b/site/css/ponymail2.css
@@ -85,7 +85,7 @@ body, html {
     background: #78BF3B;
     border-radius: 3px;
     color: #FFF;
-    width: 110px;
+    width: 90px;
     text-align: center;
     margin-bottom: 3px;
     padding: 1px;
@@ -113,14 +113,27 @@ body, html {
     background: #648BAD;
     border-radius: 3px;
     color: #FFF;
-    margin-left: 5px;
-    width: 100px;
+    margin-left: 10px;
+    width: 70px;
     text-align: center;
     margin-bottom: 2px;
     padding: 1px;
+    font-size: 90%;
 }
 
 
+.calendar_month_selected {
+    background: #4D9ADD;
+    border-radius: 3px;
+    color: #FFF;
+    margin-left: 10px;
+    width: 70px;
+    text-align: center;
+    margin-bottom: 2px;
+    padding: 1px;
+    font-size: 90%;
+}
+
 .calendar_month:hover {
     background: #99BCDB;
     cursor: pointer;
@@ -142,7 +155,7 @@ body, html {
     border: 1px solid #666;
     padding: 10px;
     background: #DDD;
-    width: 120px;
+    width: 100px;
     float: left;
     font-family: sans-serif;
     font-size: 9pt;

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ccf73acf/site/js/coffee/calendar.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/calendar.coffee b/site/js/coffee/calendar.coffee
index 0deb851..eddcf29 100644
--- a/site/js/coffee/calendar.coffee
+++ b/site/js/coffee/calendar.coffee
@@ -29,6 +29,12 @@ class Calendar
         
         [eYear, eMonth] = [now.getFullYear(), now.getMonth()+1]
         
+        [jYear, jMonth] = [0,0]
+        if jumpTo
+            [jYear, jMonth] = String(jumpTo).split("-", 2)
+            jYear = parseInt(jYear)
+            jMonth = parseInt(jMonth)
+        
         ### If end year+month given, use it ###
         if end
             [eYear, eMonth] = String(end).split("-")
@@ -55,7 +61,7 @@ class Calendar
             ### Construct the placeholder for months ###
             ### Hide unless active year ###
             monthsDiv = new HTML('div', {
-                class: if (jumpTo and jumpTo == year) or
+                class: if (jumpTo and jYear == year) or
                         (not jumpTo and year == parseInt(eYear))
                         then "calendar_months"
                         else "calendar_months_hidden"
@@ -66,8 +72,11 @@ class Calendar
             for month in [12..1]
                 ### Make sure this is within the start<->end range ###
                 if (year > sYear or month >= sMonth) and (year < eYear or month <= eMonth)
+                    extra = ""
+                    if jumpTo and jYear == year and jMonth == month
+                        extra = "calendar_month_selected"
                     monthDiv = new HTML('div', {
-                        class: "calendar_month"
+                        class: "calendar_month #{extra}"
                         id: "calendar_month_#{uid}_#{year}-#{month}"
                         data: "#{year}-#{month}"
                         onclick: "toggleMonth(this)"
@@ -90,10 +99,12 @@ class Calendar
 toggleYear = (div) ->
     
     ### Get the start and end year from the parent div ###
-    [sYear, eYear] = div.parentNode.getAttribute('data').split("-")
+    [sYear, eYear] = div.getAttribute('data').split("-")
     
     ### Get the year we clicked on ###
-    year = parseInt(div.getAttribute("data"))
+    [year, month] = div.getAttribute("data").split("-")
+    year = parseInt(year)
+    month = parseInt(month)
     
     ## Get Calendar UID
     uid = div.parentNode.getAttribute("id")
@@ -107,6 +118,7 @@ toggleYear = (div) ->
             
 toggleMonth = (div) ->
     #### TODO later... ###
+    uid = div.parentNode.parentNode.getAttribute("id")
     m = div.getAttribute("data")
     [year, month] = m.split("-")
     

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ccf73acf/site/js/coffee/listview.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview.coffee b/site/js/coffee/listview.coffee
index 45f0a69..8f97c79 100644
--- a/site/js/coffee/listview.coffee
+++ b/site/js/coffee/listview.coffee
@@ -101,7 +101,7 @@ renderListView = (json, state) ->
     
     ### Start by adding the calendar ###
     if json.firstYear and json.lastYear
-        cal = new Calendar(json.firstYear, json.lastYear)
+        cal = new Calendar(json.firstYear, json.lastYear, ponymail_month)
         get('calendar').empty().inject(cal)
         
     lv = new BasicListView(json)


[10/11] incubator-ponymail git commit: start work on the top menu

Posted by hu...@apache.org.
start work on the top menu

populate with available lists, sorted by usage


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

Branch: refs/heads/coffee-and-cake
Commit: 346ed350cd2e611463859f5fae13d45604ffc12c
Parents: 9d75f3c
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:23:01 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:23:01 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/preferences.coffee | 41 +++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/346ed350/site/js/coffee/preferences.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/preferences.coffee b/site/js/coffee/preferences.coffee
index 4ec06ab..0e691dd 100644
--- a/site/js/coffee/preferences.coffee
+++ b/site/js/coffee/preferences.coffee
@@ -15,9 +15,48 @@
  limitations under the License.
 ###
 
+### maxLists: default max lists to show in top menu before resorting to 'more lists' ###
+maxLists = 2
+
 setupAccount = (json, state) ->
-    if json and isArray(json.lists)
+    myDomain = []
+    
+    ### run parseURL for fetch list and domain ###
+    parseURL()
+    
+    ### set up the list of...lists ###
+    if json and isHash(json.lists)
         for domain, lists of json.lists
             ponymail_lists[domain] = lists
+            ### if current domain, set up the top menu to use it ###
+            if domain == ponymail_domain
+                myDomain = lists
+        
+    ### Are we on list.html? ###
     if state.listview
+        ### Generate the lists part of the top menu ###
+        lmenu = get('listmenu')
+        if lmenu
+            ### Make an array of mailing lists ###
+            sortedList = []
+            for list, number of myDomain
+                sortedList.push(list)
+            ### Sort descending by business ###
+            sortedList.sort((a,b) => if myDomain[a] < myDomain[b] then 1 else -1)
+            for list in sortedList[0..maxLists-1]
+                li = new HTML('li', {},
+                              new HTML('a', { href: "?#{list}@#{ponymail_domain}", onclick: "listView({list: '#{list}@#{ponymail_domain}'}); return false;"}, list+'@')
+                              )
+                lmenu.inject(li)
+                
+            ### Do we have more lists?? ###
+            if sortedList.length > maxLists
+                ### Remove the first N lists, sort the rest by name ###
+                sortedList.splice(0,maxLists)
+                sortedList.sort()
+                
+                li = new HTML('li', {}, "More lists \u2304")
+                lmenu.inject(li)
+                
+        ### Call listView to fetch email ###
         listView(null, true)
\ No newline at end of file


[05/11] incubator-ponymail git commit: allow new HTML to be a clone of something else

Posted by hu...@apache.org.
allow new HTML to be a clone of something else


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

Branch: refs/heads/coffee-and-cake
Commit: 10871346b62343f1efde736d41bd05cb50c12d0d
Parents: 6cbeaf5
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:20:47 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:20:47 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/dom_utils.coffee | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/10871346/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index b77e326..434e8f4 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -38,8 +38,11 @@
 
 class HTML
     constructor: (type, params, children) ->
-        ### create the raw element ###
-        @element = document.createElement(type)
+        ### create the raw element, or clone if passed an existing element ###
+        if typeof type is 'object'
+            @element = type.cloneNode()
+        else
+            @element = document.createElement(type)
         
         ### If params have been passed, set them ###
         if isHash(params)


[09/11] incubator-ponymail git commit: use YYY-MM-DD HH:mm format

Posted by hu...@apache.org.
use YYY-MM-DD HH:mm format


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

Branch: refs/heads/coffee-and-cake
Commit: 9d75f3c432c3454c4129f9cbcee1f29407cbbbb6
Parents: 61b84df
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:22:36 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:22:36 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/9d75f3c4/site/js/coffee/misc.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
index e298666..4fb4044 100644
--- a/site/js/coffee/misc.coffee
+++ b/site/js/coffee/misc.coffee
@@ -40,12 +40,14 @@ Number.prototype.pad = (n) ->
         str = "0".repeat(n-str.length) + str
     return str
 
-### Func for converting a date to YYYY-MM-DD ###
+### Func for converting a date to YYYY-MM-DD HH:MM ###
 Date.prototype.ISOBare = () ->
     y = this.getFullYear()
-    m = this.getMonth() + 1
-    d = this.getDate()
-    return y + "-" + m.pad(2) + "-" + d.pad(2)
+    m = (this.getMonth() + 1).pad(2)
+    d = this.getDate().pad(2)
+    h = this.getHours().pad(2)
+    M = this.getMinutes().pad(2)
+    return "#{y}-#{m}-#{d} #{h}:#{M}"
 
 ### isArray: function to detect if an object is an array ###
 isArray = (value) ->


[07/11] incubator-ponymail git commit: implement a caching feature for list data

Posted by hu...@apache.org.
implement a caching feature for list data


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

Branch: refs/heads/coffee-and-cake
Commit: cb209e2b3a56641f50059e46fe88ad56289c39bc
Parents: 91a25ee
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:21:41 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:21:41 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview.coffee | 38 +++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/cb209e2b/site/js/coffee/listview.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview.coffee b/site/js/coffee/listview.coffee
index 8f97c79..cd9643d 100644
--- a/site/js/coffee/listview.coffee
+++ b/site/js/coffee/listview.coffee
@@ -28,6 +28,7 @@ parseURL = () ->
     ponymail_list = list
     ponymail_month = month||""
     ponymail_query = query||""
+    [ponymail_listname, ponymail_domain] = list.split("@")
     
     
 
@@ -90,15 +91,40 @@ listView = (hash, reParse) ->
     pargs = "d=30"
     if ponymail_month and ponymail_month.length > 0
         pargs = "s=#{ponymail_month}&e=#{ponymail_month}"
-    r = new HTTPRequest(
-        "api/stats.lua?list=#{list}&domain=#{domain}&#{pargs}",
-        {
-            callback: renderListView
-        }
-        )
+    
+    ### If we already fetched this URL once, only do an update check ###
+    if ponymail_list_json[newhref] and ponymail_list_json[newhref].unixtime > 0
+        since = ponymail_list_json[newhref].unixtime
+        r = new HTTPRequest(
+            "api/stats.lua?list=#{list}&domain=#{domain}&#{pargs}&since=#{since}",
+            {
+                callback: renderListView
+                state: {
+                    href: newhref
+                }
+            }
+            )
+    else
+        r = new HTTPRequest(
+            "api/stats.lua?list=#{list}&domain=#{domain}&#{pargs}",
+            {
+                callback: renderListView
+                state: {
+                    href: newhref
+                }
+            }
+            )
     
 renderListView = (json, state) ->
     
+    ### If this is a cache check callback, and nothing has changed, use the old JSON ###
+    if state and state.href and json.changed is false
+        json = ponymail_list_json[state.href]
+        json.cached = true
+    else if state and state.href
+        ### Save JSON in cache if new ###
+        ponymail_list_json[state.href] = json
+        
     ### Start by adding the calendar ###
     if json.firstYear and json.lastYear
         cal = new Calendar(json.firstYear, json.lastYear, ponymail_month)


[02/11] incubator-ponymail git commit: fix spinner from resetting too early

Posted by hu...@apache.org.
fix spinner from resetting too early

sometimes the animation would reset at the wrong time
this should fix things.


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

Branch: refs/heads/coffee-and-cake
Commit: f3d55c865528ce32ba527ff8c807d91f2d642802
Parents: ccf73ac
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:44:58 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:44:58 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/http_utils.coffee | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/f3d55c86/site/js/coffee/http_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/http_utils.coffee b/site/js/coffee/http_utils.coffee
index ea35036..8732f7b 100644
--- a/site/js/coffee/http_utils.coffee
+++ b/site/js/coffee/http_utils.coffee
@@ -28,22 +28,24 @@
 pending_url_operations = {}
 pending_spinner_at = 0
 
-spinCheck = (div) ->
-    now = new Date().getTime()
-    if (now - pending_spinner_at) >= 4000
-        pending_spinner_at = now
-        ndiv = div.cloneNode(true)
-        ndiv.addEventListener('animationend', (e) -> spinCheck(ndiv))
-        div.parentNode.replaceChild(ndiv, div)
-    
+spinCheck = (div, reset) ->
+    if div.style.display == "block"
+        spnow = new Date().getTime()
+        if reset or (spnow - pending_spinner_at) >= 4000
+            pending_spinner_at = spnow
+            ndiv = div.cloneNode(true)
+            #ndiv.addEventListener('animationend', (e) -> spinCheck(ndiv))
+            div.parentNode.replaceChild(ndiv, div)
+    else
+        pending_spinner_at = 0
     
 pendingURLStatus = () ->
     pending = 0
-    now = new Date().getTime()
+    spnow = new Date().getTime()
     div = get('loading')
     for url, time of pending_url_operations
         ### Is something taking too long?? ###
-        if (now - time) > 1500
+        if (spnow - time) > 1500
             pending++
             if not div
                 div = new HTML('div', {
@@ -59,7 +61,7 @@ pendingURLStatus = () ->
                     ]
                 )
                 document.body.inject(div)
-                pending_spinner_at = now
+                pending_spinner_at = spnow
                 div.addEventListener('animationend', (e) -> spinCheck(div))
                 
     
@@ -70,6 +72,9 @@ pendingURLStatus = () ->
             div.style.display = "none"
     else if div and div.style.display == "none"
         div.style.display = "block"
+        if pending_spinner_at == 0
+            pending_spinner_at = spnow
+            spinCheck(div, true)
         
 
 window.setInterval(pendingURLStatus, 500)
@@ -184,7 +189,8 @@ class HTTPRequest
                     @callback(@response, @state);
                 #### JSON parse failed? Pass on the response as plain text then ###
                 catch e
-                    @callback(@request.responseText, @state)
+                    console.log("Callback failed: " + e)
+                    @callback(JSON.parse(@request.responseText), @state)
         
     ### Standard form data joiner for POST data ###
     formdata: (kv) ->


[04/11] incubator-ponymail git commit: more css tweaks

Posted by hu...@apache.org.
more css tweaks


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

Branch: refs/heads/coffee-and-cake
Commit: 6cbeaf506e9ae4f7f9ae7a13f5c804108ee11d50
Parents: e88481f
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:20:23 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:20:23 2016 +0200

----------------------------------------------------------------------
 site/css/ponymail2.css | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/6cbeaf50/site/css/ponymail2.css
----------------------------------------------------------------------
diff --git a/site/css/ponymail2.css b/site/css/ponymail2.css
index 13acda1..d81b6f2 100644
--- a/site/css/ponymail2.css
+++ b/site/css/ponymail2.css
@@ -20,7 +20,7 @@
 
 #topMenu li:not(.logo) {
   font-family: sans-serif;
-  font-size: 10pt;
+  font-size: 9pt;
   font-weight: 500;
   padding-top: 12px;
   padding-bottom: 12px;
@@ -288,21 +288,24 @@ h3, h2, h1 {
 
 /* listview styles */
 .listview_item {
-    border-radius: 3px;
-    border: 1px solid #666;
+    border-radius: 2px;
+    border: 1px solid #999;
     padding: 2px;
-    margin: 2px;
+    margin: 1px;
     float: left;
     width: calc(100% - 8px);
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
+    background: #FAFAFA;
 }
 
-.listview_item img {
+.listview_item img.gravatar {
     vertical-align: middle;
     margin-right: 8px;
     float: left;
+    margin-top: 4px;
+    margin-bottom: 4px;
 }
 
 .listview_item div:not(.listview_right) {
@@ -316,14 +319,14 @@ h3, h2, h1 {
 }
 
 .listview_item div:nth-child(3) {
-    width: calc(100% - 420px);
+    width: calc(100% - 450px);
 }
 
 .listview_right {
     float: right !important;
     background: #1789D6;
     border-radius: 3px;
-    border: 1px solid rgba(0,0,0,0.1);
+    border: 1px solid rgba(0,0,0,0.05);
     padding: 2px;
     margin-top: 6px;
     color: #FFF;
@@ -337,7 +340,7 @@ h3, h2, h1 {
 }
 
 .listview_grey {
-    background: #888;
+    background: #777;
 }
 
 a {


[06/11] incubator-ponymail git commit: add some more default (global) vars

Posted by hu...@apache.org.
add some more default (global) vars

list part, domain part and a place to store fetched
emails


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

Branch: refs/heads/coffee-and-cake
Commit: 91a25ee628c25e1aa4e6ebcb958cd0b168db94a8
Parents: 1087134
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:21:20 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:21:20 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/defaults.coffee | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/91a25ee6/site/js/coffee/defaults.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/defaults.coffee b/site/js/coffee/defaults.coffee
index 82af3d9..ffac413 100644
--- a/site/js/coffee/defaults.coffee
+++ b/site/js/coffee/defaults.coffee
@@ -21,4 +21,8 @@ ponymail_version = "0.10-coffee-and-cake"
 ponymail_lists = {}
 ponymail_list = ""
 ponymail_month = ""
-ponymail_query = ""
\ No newline at end of file
+ponymail_query = ""
+
+ponymail_listname = ""
+ponymail_domain = ""
+ponymail_list_json = {}
\ No newline at end of file


[08/11] incubator-ponymail git commit: caching features for basic listview

Posted by hu...@apache.org.
caching features for basic listview

- cache icons as templates
- use cachec JSON (and treat as cache) if available


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

Branch: refs/heads/coffee-and-cake
Commit: 61b84df708196ca7ca2e3ebb73ac9b83e78e3cd9
Parents: cb209e2
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:22:22 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:22:22 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/61b84df7/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index dd45bcf..3da3314 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -33,7 +33,10 @@ class BasicListView
         
         ### If we got results, use scroll() to display from result 0 on ###
         if isArray(@json.thread_struct) and @json.thread_struct.length > 0
-            @json.thread_struct.reverse()
+            ### Reverse thread struct, but only if we're not using an
+            # already reversed cache ###
+            if not @json.cached
+                @json.thread_struct.reverse()
             @scroll(@rpp, @pos)
         else
             ### No results, just say...that ###
@@ -47,6 +50,10 @@ class BasicListView
         ### Clear the list view ###
         @lv = @lv.empty()
         
+        ### Make some pre-defined html object templates ###
+        peopleimg = new HTML('img', {src: 'images/avatar.png', style: { verticalAlign: 'middle', width: "12px", height: "12px"}})
+        envelopeimg = new HTML('img', {src: 'images/envelope.png', style: { verticalAlign: 'middle', width: "16px", height: "12px"}})
+        
         ### For each email result,...###
         for item in @json.thread_struct[pos...(pos+rpp)]
             original = @findEmail(item.tid)
@@ -63,7 +70,7 @@ class BasicListView
                 
                 
                 ### Gravatar ###
-                avatar = new HTML('img', { src: "https://secure.gravatar.com/avatar/#{original.gravatar}.png?s=24&r=g&d=mm"})
+                avatar = new HTML('img', { class: "gravatar", src: "https://secure.gravatar.com/avatar/#{original.gravatar}.png?s=24&r=g&d=mm"})
                 
                 ### Sender, without the <fo...@bar> part - just the name ###
                 sender = new HTML('div', {style: {fontWeight: "bold"}}, original.from.replace(/\s*<.+>/, "").replace(/"/g, ''))
@@ -80,8 +87,13 @@ class BasicListView
                     new HTML('span', { style: { color: "#999", fontSize: "0.7rem"}}, item.body)
                 ])
                 
-                ### replies and authors ###
-                stats = new HTML('div', {class:"listview_right"}, " #{people} people, #{noeml} replies")
+                ### show number of replies and participants ###
+                stats = new HTML('div', {class:"listview_right"}, [
+                    peopleimg.cloneNode(),
+                    " #{people}  ",
+                    envelopeimg.cloneNode(),
+                    " #{noeml}"
+                    ])
                 
                 ### Add date; yellow if <= 1day, grey otherwise ###
                 date_style = "listview_grey"
@@ -89,13 +101,17 @@ class BasicListView
                     date_style = "listview_yellow"
                 date = new HTML('div', {class:"listview_right #{date_style}"}, new Date(item.epoch*1000).ISOBare())
                 
-                item = new HTML('div', {id: uid, data: item.tid, class: "listview_item"}, [avatar, sender, subject, date, stats])
                 
+                ### Finally, pull it all together in a div and add that to the listview ###
+                item = new HTML('div', {id: uid, data: item.tid, class: "listview_item"}, [avatar, sender, subject, date, stats])
                 @lv.inject(item)
         
         now = new Date().getTime()
         diff = now - @lastScroll
-        @lv.inject("Fetched in " + parseInt(@json.took/1000) + "ms, rendered in " + parseInt(diff) + "ms.")
+        if @json.cached
+            @lv.inject("Fetched from cache (no updates detected), rendered in " + parseInt(diff) + "ms.")
+        else
+            @lv.inject("Fetched in " + parseInt(@json.took/1000) + "ms, rendered in " + parseInt(diff) + "ms.")
     ### findEmail: find an email given an ID ###
     findEmail: (id) ->
         for email in @json.emails


[11/11] incubator-ponymail git commit: drop fake list items from menu

Posted by hu...@apache.org.
drop fake list items from menu


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

Branch: refs/heads/coffee-and-cake
Commit: 6f91ffad21ec769f32cdc269140034f24f063e33
Parents: 346ed35
Author: Daniel Gruno <hu...@apache.org>
Authored: Sun Sep 4 09:23:12 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sun Sep 4 09:23:12 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/6f91ffad/site/js/coffee/scaffolding.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/scaffolding.coffee b/site/js/coffee/scaffolding.coffee
index 26e2abe..878b340 100644
--- a/site/js/coffee/scaffolding.coffee
+++ b/site/js/coffee/scaffolding.coffee
@@ -23,7 +23,7 @@ listviewScaffolding = () ->
     document.body.inject(menu)
     
     # Add menu points
-    ul = new HTML('ul')
+    ul = new HTML('ul', { id: 'listmenu'})
     
     # Add logo first
     logo = new HTML('li', {
@@ -39,13 +39,9 @@ listviewScaffolding = () ->
         }
     })))
     ul.inject(logo)
-    
-    # Menu points
-    for item in ['Home', 'Lists', 'Third item']
-        li = new HTML('li', {}, item)
-        ul.inject(li)
     menu.inject(ul)
     
+    
     ### Now, make the base div ###
     mainDiv = new HTML('div', { id: "contents"})
     document.body.inject(mainDiv)


[03/11] 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/e88481fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/e88481fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/e88481fa

Branch: refs/heads/coffee-and-cake
Commit: e88481fa684acb1b5a3893896781073be78bc2de
Parents: f3d55c8
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:45:08 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:45:08 2016 +0200

----------------------------------------------------------------------
 site/js/ponymail-coffee.js | 60 ++++++++++++++++++++++++++---------------
 1 file changed, 39 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/e88481fa/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index a01ac2d..1999271 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -13,17 +13,23 @@ calendar_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July
 
 Calendar = (function() {
   function Calendar(start, end, jumpTo) {
-    var div, eMonth, eYear, j, month, monthDiv, monthsDiv, now, o, ref, ref1, ref2, ref3, ref4, sMonth, sYear, uid, yDiv, year, years;
+    var div, eMonth, eYear, extra, j, jMonth, jYear, month, monthDiv, monthsDiv, now, o, ref, ref1, ref2, ref3, ref4, ref5, ref6, sMonth, sYear, uid, yDiv, year, years;
     now = new Date();
     uid = parseInt(Math.random() * 100000000).toString(16);
 
     /* Split start and end into years and months */
     ref = String(start).split("-"), sYear = ref[0], sMonth = ref[1];
     ref1 = [now.getFullYear(), now.getMonth() + 1], eYear = ref1[0], eMonth = ref1[1];
+    ref2 = [0, 0], jYear = ref2[0], jMonth = ref2[1];
+    if (jumpTo) {
+      ref3 = String(jumpTo).split("-", 2), jYear = ref3[0], jMonth = ref3[1];
+      jYear = parseInt(jYear);
+      jMonth = parseInt(jMonth);
+    }
 
     /* If end year+month given, use it */
     if (end) {
-      ref2 = String(end).split("-"), eYear = ref2[0], eMonth = ref2[1];
+      ref4 = String(end).split("-"), eYear = ref4[0], eMonth = ref4[1];
 
       /* If end year is this year, restrict months to those that have passed */
       if (parseInt(eYear) === now.getFullYear()) {
@@ -41,7 +47,7 @@ Calendar = (function() {
 
     /* For each year, construct the year div to hold months */
     years = [];
-    for (year = j = ref3 = parseInt(sYear), ref4 = parseInt(eYear); ref3 <= ref4 ? j <= ref4 : j >= ref4; year = ref3 <= ref4 ? ++j : --j) {
+    for (year = j = ref5 = parseInt(sYear), ref6 = parseInt(eYear); ref5 <= ref6 ? j <= ref6 : j >= ref6; year = ref5 <= ref6 ? ++j : --j) {
       yDiv = new HTML('div', {
         id: ("calendar_year_" + uid + "_") + year,
         data: String(year),
@@ -53,7 +59,7 @@ Calendar = (function() {
 
       /* Hide unless active year */
       monthsDiv = new HTML('div', {
-        "class": (jumpTo && jumpTo === year) || (!jumpTo && year === parseInt(eYear)) ? "calendar_months" : "calendar_months_hidden",
+        "class": (jumpTo && jYear === year) || (!jumpTo && year === parseInt(eYear)) ? "calendar_months" : "calendar_months_hidden",
         id: ("calendar_months_" + uid + "_") + year
       });
 
@@ -62,8 +68,12 @@ Calendar = (function() {
 
         /* Make sure this is within the start<->end range */
         if ((year > sYear || month >= sMonth) && (year < eYear || month <= eMonth)) {
+          extra = "";
+          if (jumpTo && jYear === year && jMonth === month) {
+            extra = "calendar_month_selected";
+          }
           monthDiv = new HTML('div', {
-            "class": "calendar_month",
+            "class": "calendar_month " + extra,
             id: "calendar_month_" + uid + "_" + year + "-" + month,
             data: year + "-" + month,
             onclick: "toggleMonth(this)"
@@ -93,16 +103,18 @@ Calendar = (function() {
 toggleYear = function(div) {
 
   /* Get the start and end year from the parent div */
-  var eYear, j, ref, ref1, ref2, results, sYear, uid, y, year;
-  ref = div.parentNode.getAttribute('data').split("-"), sYear = ref[0], eYear = ref[1];
+  var eYear, j, month, ref, ref1, ref2, ref3, results, sYear, uid, y, year;
+  ref = div.getAttribute('data').split("-"), sYear = ref[0], eYear = ref[1];
 
   /* Get the year we clicked on */
-  year = parseInt(div.getAttribute("data"));
+  ref1 = div.getAttribute("data").split("-"), year = ref1[0], month = ref1[1];
+  year = parseInt(year);
+  month = parseInt(month);
   uid = div.parentNode.getAttribute("id");
 
   /* For each year, hide if not this year, else show */
   results = [];
-  for (y = j = ref1 = parseInt(sYear), ref2 = parseInt(eYear); ref1 <= ref2 ? j <= ref2 : j >= ref2; y = ref1 <= ref2 ? ++j : --j) {
+  for (y = j = ref2 = parseInt(sYear), ref3 = parseInt(eYear); ref2 <= ref3 ? j <= ref3 : j >= ref3; y = ref2 <= ref3 ? ++j : --j) {
     if (y === year) {
       results.push(get("calendar_months_" + uid + "_" + y).setAttribute("class", "calendar_months"));
     } else {
@@ -113,7 +125,8 @@ toggleYear = function(div) {
 };
 
 toggleMonth = function(div) {
-  var m, month, ref, year;
+  var m, month, ref, uid, year;
+  uid = div.parentNode.parentNode.getAttribute("id");
   m = div.getAttribute("data");
   ref = m.split("-"), year = ref[0], month = ref[1];
 
@@ -508,16 +521,17 @@ pending_url_operations = {};
 
 pending_spinner_at = 0;
 
-spinCheck = function(div) {
+spinCheck = function(div, reset) {
   var ndiv, spnow;
-  spnow = new Date().getTime();
-  if ((spnow - pending_spinner_at) >= 4000) {
-    pending_spinner_at = spnow;
-    ndiv = div.cloneNode(true);
-    ndiv.addEventListener('animationend', function(e) {
-      return spinCheck(ndiv);
-    });
-    return div.parentNode.replaceChild(ndiv, div);
+  if (div.style.display === "block") {
+    spnow = new Date().getTime();
+    if (reset || (spnow - pending_spinner_at) >= 4000) {
+      pending_spinner_at = spnow;
+      ndiv = div.cloneNode(true);
+      return div.parentNode.replaceChild(ndiv, div);
+    }
+  } else {
+    return pending_spinner_at = 0;
   }
 };
 
@@ -561,7 +575,11 @@ pendingURLStatus = function() {
       return div.style.display = "none";
     }
   } else if (div && div.style.display === "none") {
-    return div.style.display = "block";
+    div.style.display = "block";
+    if (pending_spinner_at === 0) {
+      pending_spinner_at = spnow;
+      return spinCheck(div, true);
+    }
   }
 };
 
@@ -1079,7 +1097,7 @@ renderListView = function(json, state) {
   /* Start by adding the calendar */
   var cal, lv;
   if (json.firstYear && json.lastYear) {
-    cal = new Calendar(json.firstYear, json.lastYear);
+    cal = new Calendar(json.firstYear, json.lastYear, ponymail_month);
     get('calendar').empty().inject(cal);
   }
   return lv = new BasicListView(json);