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 14:35:35 UTC
[1/7] incubator-ponymail git commit: prep CSS for threaded view
Repository: incubator-ponymail
Updated Branches:
refs/heads/coffee-and-cake f317e8286 -> a0d9ff371
prep CSS for threaded view
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/cb4ad70b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/cb4ad70b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/cb4ad70b
Branch: refs/heads/coffee-and-cake
Commit: cb4ad70bcc769c4659fa32a0d210e0b6ac92e7ad
Parents: f317e82
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:31:35 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:31:35 2016 +0200
----------------------------------------------------------------------
site/css/ponymail2.css | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/cb4ad70b/site/css/ponymail2.css
----------------------------------------------------------------------
diff --git a/site/css/ponymail2.css b/site/css/ponymail2.css
index a8bf182..f2b6376 100644
--- a/site/css/ponymail2.css
+++ b/site/css/ponymail2.css
@@ -408,6 +408,13 @@ a {
display: block;
}
+.email_header {
+ background: #FCF6D4;
+ border-bottom: 2px solid rgba(0,0,0,0.3);
+ float: left;
+ width: 100%;
+}
+
.header_key {
padding-top: 0px;
width: 80px;
@@ -423,9 +430,22 @@ a {
.email_body {
float: left;
width: 100%;
+ white-space: pre-wrap;
}
.email_quote {
border: 1px dashed #666;
background: #FFE;
+ float: left;
+}
+
+.email_boxed {
+ float: left;
+ border-radius: 4px;
+ border: 1px solid rgba(0,0,0,0.3);
+ border-left: 4px solid #0099FF;
+ padding: 5px;
+ margin: 10px;
+ clear: both;
+ width: calc(100% - 36px);
}
\ No newline at end of file
[7/7] 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/a0d9ff37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/a0d9ff37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/a0d9ff37
Branch: refs/heads/coffee-and-cake
Commit: a0d9ff37133bb7cef940168c8ae4f8f7d741f20c
Parents: 99d2a38
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:35:21 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:35:21 2016 +0200
----------------------------------------------------------------------
site/js/ponymail-coffee.js | 178 ++++++++++++++++++++++++++++++++++------
1 file changed, 152 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/a0d9ff37/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index 0d52873..419ea51 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -1,5 +1,5 @@
// Generated by CoffeeScript 1.9.3
-var BasicEmailDisplay, BasicListView, Calendar, HTML, HTTPRequest, SingleListView, 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_preferences, ponymail_query, ponymail_quote_regex, ponymail_stored_email, ponymail_url_regex, ponymail_version, readEmail, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleQuote, toggleYear, txt,
+var BasicEmailDisplay, BasicListView, Calendar, HTML, HTTPRequest, SingleListView, ThreadedEmailDisplay, 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_preferences, ponymail_query, ponymail_quote_regex, ponymail_stored_email, ponymail_url_regex, ponymail_version, readEmail, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleQuote, toggleYear, txt,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
@@ -354,7 +354,7 @@ HTML = (function() {
val = params[key];
/* Standard string value? */
- if (typeof val === "string") {
+ if (typeof val === "string" || typeof val === 'number') {
this.element.setAttribute(key, val);
} else if (isArray(val)) {
@@ -365,6 +365,9 @@ HTML = (function() {
/* Are we trying to set multiple sub elements, like a style? */
for (subkey in val) {
subval = val[subkey];
+ if (!this.element[key]) {
+ throw "No such attribute, " + key + "!";
+ }
this.element[key][subkey] = subval;
}
}
@@ -538,7 +541,7 @@ cog = function(div, size) {
readEmail = function(obj) {
/* find the original email ID and point of origin */
- var closedOne, email, j, len, mid, parent;
+ var closedOne, email, index, j, len, mid, parent;
mid = null;
parent = null;
if (typeof obj === 'string') {
@@ -569,8 +572,11 @@ readEmail = function(obj) {
}
if (!closedOne) {
+ /* Get thread index value if set, for threads */
+ index = parent.getAttribute("data-index");
+
/* We have an(other) email open now */
- ponymail_current_email = new BasicEmailDisplay(parent, mid);
+ ponymail_current_email = new ThreadedEmailDisplay(parent, mid, index);
return ponymail_email_open.push(ponymail_current_email);
}
};
@@ -616,13 +622,16 @@ BasicEmailDisplay = (function() {
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;
+ var b, date_line, from_line, headers, htmlbody, list_line, placeholder, subject_line;
+ if (!ponymail_stored_email[json.mid]) {
+ ponymail_stored_email[json.mid] = json;
}
+ placeholder = get('placeholder_' + this.mid + "_" + json.mid) || get('placeholder_' + json.mid);
/* Display email headers */
- headers = new HTML('div');
+ headers = new HTML('div', {
+ "class": "email_header"
+ });
from_line = new HTML('div', {}, [
new HTML('div', {
"class": "header_key"
@@ -664,16 +673,16 @@ BasicEmailDisplay = (function() {
}, this.list))
]);
headers.inject(list_line);
- this.placeholder.inject(headers);
+ placeholder.inject(headers);
/* parse body, convert quotes */
- this.htmlbody = this.quotify(json.body);
+ htmlbody = this.quotify(json.body);
/* Now inject the body */
b = new HTML('pre', {
"class": "email_body"
- }, this.htmlbody);
- return this.placeholder.inject(b);
+ }, htmlbody);
+ return placeholder.inject(b);
};
@@ -826,6 +835,121 @@ toggleQuote = function(div) {
*/
+/* threaded email display class - extends BasicEmail Display */
+
+ThreadedEmailDisplay = (function(superClass) {
+ extend(ThreadedEmailDisplay, superClass);
+
+ function ThreadedEmailDisplay(parent1, mid1, index) {
+ var me, thread;
+ 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;
+
+ /* Find the thread or fake one */
+ thread = {
+ tid: this.mid
+ };
+ if (index && ponymail_current_listview && ponymail_current_listview.json.thread_struct[index]) {
+ thread = ponymail_current_listview.json.thread_struct[index];
+ }
+ this.threadedFetch(this.placeholder, thread, 1);
+ return this;
+ }
+
+ ThreadedEmailDisplay.prototype.threadedFetch = function(parent, thread, nestedness) {
+
+ /* Make the thread item placeholder */
+ var bcolor, bcolors, bodyplace, item, j, len, me, place, r, ref, replyplace;
+ bodyplace = new HTML('div', {
+ id: "placeholder_" + this.mid + "_" + thread.tid,
+ "class": "email_boxed"
+ });
+
+ /* Assign a random color to the left */
+ bcolors = ['#C93F20', '#20C94A', '#2063C9', '#C9AA20', '#AD20C9', '#99C920', '#20C9C3'];
+ bcolor = bcolors[Math.round(Math.random() * bcolors.length)];
+ bodyplace.style.borderLeft = "4px solid " + bcolor;
+ replyplace = new HTML('div', {
+ id: "thread_replies_" + this.mid + "_" + thread.tid,
+ style: {
+ marginLeft: "20px"
+ }
+ });
+ place = new HTML('div', {
+ id: "thread_parent_" + this.mid + "_" + thread.tid,
+ style: {
+ float: "left",
+ width: "100%"
+ }
+ }, [bodyplace, replyplace]);
+ parent.inject(place);
+
+ /* Do we have this email in cache? */
+ if (ponymail_stored_email[thread.tid]) {
+ this.render(ponymail_stored_email[thread.tid]);
+ } else {
+ me = this;
+
+ /* Not stored, fetch the email first */
+ r = new HTTPRequest("api/email.lua?", {
+ get: {
+ id: thread.tid
+ },
+ callback: function(json, state) {
+ return me.render(json, state);
+ },
+ state: {
+ nest: Math.min(nestedness + 1, 5)
+ }
+ });
+ }
+
+ /* Now do the same for each child item */
+ if (thread.children && isArray(thread.children) && thread.children.length > 0) {
+ ref = thread.children;
+ for (j = 0, len = ref.length; j < len; j++) {
+ item = ref[j];
+ this.threadedFetch(replyplace, item, Math.min(nestedness + 1, 5));
+ }
+ }
+ return this;
+ };
+
+ return ThreadedEmailDisplay;
+
+})(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
@@ -1351,21 +1475,21 @@ BasicListView = (function() {
BasicListView.prototype.renderItems = function() {
/* For each email result,... */
- var item, j, lastitem, len, lvitem, original, ref;
+ var i, item, j, lastitem, len, lvitem, original, ref;
this.lvitems = new HTML('div', {
"class": "listview_table"
});
lastitem = null;
ref = this.json.thread_struct.slice(this.pos, this.pos + this.rpp);
- for (j = 0, len = ref.length; j < len; j++) {
- item = ref[j];
+ for (i = j = 0, len = ref.length; j < len; i = ++j) {
+ item = ref[i];
original = this.findEmail(item.tid);
/* Be sure we actually have an email here */
if (original) {
/* Call listViewItem to compile a list view HTML element */
- lvitem = this.listViewItem(original, item);
+ lvitem = this.listViewItem(original, item, i + this.pos);
lastitem = lvitem;
/* Inject new item into the list view */
@@ -1395,19 +1519,20 @@ BasicListView = (function() {
/* countEmail: func for counting how many emails are in a thread */
BasicListView.prototype.countEmail = function(thread) {
- var item, j, len, n, ref;
- n = 0;
- if (thread.children) {
- ref = (isArray(thread.children) ? thread.children : []);
+ var item, j, len, nc, nnc, ref;
+ nc = 0;
+ if (thread.children && isArray(thread.children)) {
+ ref = thread.children;
for (j = 0, len = ref.length; j < len; j++) {
item = ref[j];
- n++;
- if (isArray(item.children) && item.children.length > 0) {
- n += this.countEmail(item.children);
+ nc++;
+ if (item.children && isArray(item.children) && item.children.length > 0) {
+ nnc = this.countEmail(item);
+ nc += nnc;
}
}
}
- return n;
+ return nc;
};
@@ -1446,7 +1571,7 @@ BasicListView = (function() {
}
};
- BasicListView.prototype.listViewItem = function(original, thread) {
+ BasicListView.prototype.listViewItem = function(original, thread, index) {
/* Be sure we actually have an email here */
var avatar, date, date_style, envelopeimg, item, noeml, now, people, peopleimg, readStyle, sender, stats, subject, uid;
@@ -1528,6 +1653,7 @@ BasicListView = (function() {
item = new HTML('div', {
id: uid,
data: thread.tid,
+ 'data-index': index,
"class": "listview_item"
}, new HTML('div', {
"class": "listview_summary"
@@ -1743,7 +1869,7 @@ renderListView = function(json, state) {
cal = new Calendar(json.firstYear, json.lastYear, ponymail_month);
get('calendar').empty().inject(cal);
}
- return lv = new SingleListView(json);
+ return lv = new BasicListView(json);
};
[3/7] incubator-ponymail git commit: prep for inclusion of threaded
email view
Posted by hu...@apache.org.
prep for inclusion of threaded email view
rework the class for easier extendability
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/c1959d06
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/c1959d06
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/c1959d06
Branch: refs/heads/coffee-and-cake
Commit: c1959d06f74111e4c5c537d756bd12f2cb67a446
Parents: bbb5715
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:32:54 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:32:54 2016 +0200
----------------------------------------------------------------------
site/js/coffee/email_display_basic.coffee | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/c1959d06/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
index d149ac1..ce6326a 100644
--- a/site/js/coffee/email_display_basic.coffee
+++ b/site/js/coffee/email_display_basic.coffee
@@ -42,8 +42,10 @@ readEmail = (obj) ->
break
if not closedOne
+ ### Get thread index value if set, for threads ###
+ index = parent.getAttribute("data-index")
### We have an(other) email open now ###
- ponymail_current_email = new BasicEmailDisplay(parent, mid)
+ ponymail_current_email = new ThreadedEmailDisplay(parent, mid, index)
ponymail_email_open.push(ponymail_current_email)
### Basic email display class ###
@@ -77,11 +79,13 @@ class BasicEmailDisplay
render: (json, state) ->
### Store email in cache if not there already ###
- if not ponymail_stored_email[@mid]
- ponymail_stored_email[@mid] = json
+ if not ponymail_stored_email[json.mid]
+ ponymail_stored_email[json.mid] = json
+
+ placeholder = get('placeholder_' + @mid + "_" + json.mid) || get('placeholder_' + json.mid)
### Display email headers ###
- headers = new HTML('div')
+ headers = new HTML('div', {class: "email_header"})
from_line = new HTML('div', {},
[
@@ -115,15 +119,15 @@ class BasicEmailDisplay
])
headers.inject(list_line)
- @placeholder.inject(headers)
+ placeholder.inject(headers)
### parse body, convert quotes ###
- @htmlbody = @quotify(json.body)
+ htmlbody = @quotify(json.body)
### Now inject the body ###
- b = new HTML('pre', {class: "email_body"}, @htmlbody)
- @placeholder.inject(b)
+ b = new HTML('pre', {class: "email_body"}, htmlbody)
+ placeholder.inject(b)
### quotify: put quotes inside quote blocks ###
quotify: (splicer) ->
[2/7] incubator-ponymail git commit: also allow numbers,
balk if a key is missing
Posted by hu...@apache.org.
also allow numbers, balk if a key is missing
allow numbers to be set as attribute values
complain if we try to sub-edit an attribute that doesn't exist
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/bbb5715c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/bbb5715c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/bbb5715c
Branch: refs/heads/coffee-and-cake
Commit: bbb5715c65e3ae49e3142d8e89982419a0cd9694
Parents: cb4ad70
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:32:16 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:32:16 2016 +0200
----------------------------------------------------------------------
site/js/coffee/dom_utils.coffee | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/bbb5715c/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index 434e8f4..d84d4f6 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -48,7 +48,7 @@ class HTML
if isHash(params)
for key, val of params
### Standard string value? ###
- if typeof val is "string"
+ if typeof val is "string" or typeof val is 'number'
@element.setAttribute(key, val)
else if isArray(val)
### Are we passing a list of data to set? concatenate then ###
@@ -56,6 +56,8 @@ class HTML
else if isHash(val)
### Are we trying to set multiple sub elements, like a style? ###
for subkey,subval of val
+ if not @element[key]
+ throw "No such attribute, #{key}!"
@element[key][subkey] = subval
### If any children have been passed, add them to the element ###
[4/7] incubator-ponymail git commit: add threaded display mode for
email
Posted by hu...@apache.org.
add threaded display mode for email
this extends the basic (single) email view by adding a
thread-aware fetcher that iterates over children and
then calls render() on each of them.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/d9d01681
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/d9d01681
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/d9d01681
Branch: refs/heads/coffee-and-cake
Commit: d9d01681d980661fd9b03a1441dab4da35b0e1d9
Parents: c1959d0
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:33:48 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:33:48 2016 +0200
----------------------------------------------------------------------
site/js/coffee/email_display_threaded.coffee | 94 +++++++++++++++++++++++
1 file changed, 94 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/d9d01681/site/js/coffee/email_display_threaded.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/email_display_threaded.coffee b/site/js/coffee/email_display_threaded.coffee
new file mode 100644
index 0000000..015e77b
--- /dev/null
+++ b/site/js/coffee/email_display_threaded.coffee
@@ -0,0 +1,94 @@
+###
+ 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.
+###
+
+### threaded email display class - extends BasicEmail Display ###
+class ThreadedEmailDisplay extends BasicEmailDisplay
+ constructor: (@parent, @mid, index) ->
+ @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
+
+ ### Find the thread or fake one ###
+ thread = {tid: @mid}
+ if index and ponymail_current_listview and ponymail_current_listview.json.thread_struct[index]
+ thread = ponymail_current_listview.json.thread_struct[index]
+
+ @threadedFetch(@placeholder, thread, 1)
+ return this
+
+ threadedFetch: (parent, thread, nestedness) ->
+ ### Make the thread item placeholder ###
+ bodyplace = new HTML('div', {id: "placeholder_#{@mid}_#{thread.tid}", class:"email_boxed"})
+
+ ### Assign a random color to the left ###
+ bcolors = ['#C93F20', '#20C94A', '#2063C9', '#C9AA20', '#AD20C9', '#99C920', '#20C9C3']
+ bcolor = bcolors[Math.round(Math.random()*bcolors.length)]
+ bodyplace.style.borderLeft = "4px solid " + bcolor
+
+ replyplace = new HTML('div', {
+ id: "thread_replies_#{@mid}_#{thread.tid}",
+ style: {
+
+ marginLeft: "20px"
+ }
+ })
+ place = new HTML('div',
+ {
+ id: "thread_parent_#{@mid}_#{thread.tid}",
+ style: {
+ float: "left"
+ width: "100%"
+ }
+ }, [
+ bodyplace,
+ replyplace
+ ]
+ )
+ parent.inject(place)
+
+ ### Do we have this email in cache? ###
+ if ponymail_stored_email[thread.tid]
+ @render(ponymail_stored_email[thread.tid])
+ else
+ me = this
+ ### Not stored, fetch the email first ###
+ r = new HTTPRequest("api/email.lua?", {
+ get: {
+ id: thread.tid
+ }
+ callback: (json, state) ->
+ me.render(json, state)
+ state: {
+ nest: Math.min(nestedness+1, 5) # Don't wanna nest more than 5 levels!
+ }
+ })
+
+ ### Now do the same for each child item ###
+ if thread.children and isArray(thread.children) and thread.children.length > 0
+ for item in thread.children
+ @threadedFetch(replyplace, item, Math.min(nestedness+1, 5))
+ return this
+
+
\ No newline at end of file
[5/7] incubator-ponymail git commit: switch back to threaded list view
Posted by hu...@apache.org.
switch back to threaded list view
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/1eb5d985
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/1eb5d985
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/1eb5d985
Branch: refs/heads/coffee-and-cake
Commit: 1eb5d98532ffa38405786f4b63d4c31459c9e0c5
Parents: d9d0168
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:34:14 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:34:14 2016 +0200
----------------------------------------------------------------------
site/js/coffee/listview.coffee | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/1eb5d985/site/js/coffee/listview.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview.coffee b/site/js/coffee/listview.coffee
index f052e50..cbc1e65 100644
--- a/site/js/coffee/listview.coffee
+++ b/site/js/coffee/listview.coffee
@@ -133,5 +133,5 @@ renderListView = (json, state) ->
cal = new Calendar(json.firstYear, json.lastYear, ponymail_month)
get('calendar').empty().inject(cal)
- lv = new SingleListView(json)
+ lv = new BasicListView(json)
\ No newline at end of file
[6/7] incubator-ponymail git commit: fixups for basic list view
Posted by hu...@apache.org.
fixups for basic list view
- fix the reply counter
- prep for threaded view by assigining a data-index attribute
- pass along data-index to the email display class
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/99d2a389
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/99d2a389
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/99d2a389
Branch: refs/heads/coffee-and-cake
Commit: 99d2a389d512814d7828d591b42b874ba0437efc
Parents: 1eb5d98
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 16:35:14 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 16:35:14 2016 +0200
----------------------------------------------------------------------
site/js/coffee/listview_basic.coffee | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/99d2a389/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index a56cb3d..54c8e16 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -142,12 +142,12 @@ class BasicListView
### For each email result,...###
@lvitems = new HTML('div', { class: "listview_table" })
lastitem = null
- for item in @json.thread_struct[@pos...(@pos+@rpp)]
+ for item, i in @json.thread_struct[@pos...(@pos+@rpp)]
original = @findEmail(item.tid)
### Be sure we actually have an email here ###
if original
### Call listViewItem to compile a list view HTML element ###
- lvitem = @listViewItem(original, item)
+ lvitem = @listViewItem(original, item, i+@pos)
lastitem = lvitem
### Inject new item into the list view ###
@@ -164,13 +164,14 @@ class BasicListView
### countEmail: func for counting how many emails are in a thread ###
countEmail: (thread) ->
- n = 0
- if thread.children
- for item in (if isArray(thread.children) then thread.children else [])
- n++
- if isArray(item.children) and item.children.length > 0
- n += @countEmail(item.children)
- return n
+ nc = 0
+ if thread.children and isArray(thread.children)
+ for item in thread.children
+ nc++
+ if item.children and isArray(item.children) and item.children.length > 0
+ nnc = @countEmail(item)
+ nc += nnc
+ return nc
### countPeople: func for counting how many people are in a thread ###
countPeople: (thread, p) ->
@@ -194,7 +195,7 @@ class BasicListView
n++
return n
- listViewItem: (original, thread) ->
+ listViewItem: (original, thread, index) ->
### Be sure we actually have an email here ###
if original and thread
now = new Date().getTime()/1000
@@ -245,7 +246,12 @@ 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"},
+ item = new HTML('div', {
+ id: uid,
+ data: thread.tid,
+ 'data-index': index,
+ class: "listview_item"
+ },
new HTML('div', {class:"listview_summary"}, [avatar, sender, subject, date, stats])
)
return item