ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [4/4] incubator-ponymail git commit: regen JS
Date Mon, 05 Sep 2016 19:06:08 GMT
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/37f71028
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/37f71028
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/37f71028

Branch: refs/heads/coffee-and-cake
Commit: 37f71028bbca3f7a16258d59e1322d512193f81d
Parents: 46511fe
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Mon Sep 5 21:05:50 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Mon Sep 5 21:05:50 2016 +0200

----------------------------------------------------------------------
 site/js/ponymail-coffee.js | 151 ++++++++++++++++++++++++++++++++++------
 1 file changed, 128 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/37f71028/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index 9b0f28d..e1f7e22 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, DateEmailDisplay, 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,
+var BasicEmailDisplay, BasicListView, Calendar, DateEmailDisplay, HTML, HTTPRequest, SingleListView,
ThreadedEmailDisplay, calendar_months, cog, dbRead, dbWrite, dealWithKeyboard, e, footerScaffolding,
genColors, get, hasRead, headerScaffolding, 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_display_models, ponymail_domain, ponymail_email_open, ponymail_list, ponymail_list_json,
ponymail_listname, ponymail_lists, ponymail_listview_models, ponymail_month, ponymail_preferences,
ponymail_query, ponymail_quote_regex, ponymail_register_display, ponymail_register_listview,
ponymail_stored_email, ponymail_url_regex, ponymail_version, readEmail, renderListView, scaffoldingEmailCallback,
set, setupAccount, spinCheck, testCoffee, testToggle, threadScaffolding, toggleMonth, toggleQuot
 e, 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;
 
@@ -322,6 +322,45 @@ ponymail_preferences = {};
  */
 
 
+/* Various register functions */
+
+ponymail_listview_models = {};
+
+ponymail_display_models = {};
+
+ponymail_register_listview = function(name, title, cl) {
+  return ponymail_listview_models[name] = {
+    title: title,
+    "class": cl
+  };
+};
+
+ponymail_register_display = function(name, title, cl) {
+  return ponymail_display_models[name] = {
+    title: title,
+    "class": cl
+  };
+};
+
+
+/*
+ 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.
+ */
+
+
 /**
  * HTML: DOM creator class
  * args:
@@ -838,6 +877,8 @@ BasicEmailDisplay = (function() {
 
 })();
 
+ponymail_register_display('default', "Single email view", BasicEmailDisplay);
+
 
 /* toggleQuote: show/hide a quote */
 
@@ -986,6 +1027,8 @@ DateEmailDisplay = (function(superClass) {
 
 })(BasicEmailDisplay);
 
+ponymail_register_display('date', "Stacked view", DateEmailDisplay);
+
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1010,30 +1053,37 @@ DateEmailDisplay = (function(superClass) {
 ThreadedEmailDisplay = (function(superClass) {
   extend(ThreadedEmailDisplay, superClass);
 
-  function ThreadedEmailDisplay(parent1, mid1, index) {
+  function ThreadedEmailDisplay(parent1, mid1, index, tjson) {
     var me, thread;
     this.parent = parent1;
     this.mid = mid1;
+    if (tjson == null) {
+      tjson = null;
+    }
     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])
{
+    if (tjson) {
+      thread = tjson;
+      this.mid = tjson.mid;
+      this.parent = get('email_placeholder');
+    } else if (index && ponymail_current_listview && ponymail_current_listview.json.thread_struct[index])
{
       thread = ponymail_current_listview.json.thread_struct[index];
     }
+
+    /* 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);
     this.threadedFetch(this.placeholder, thread, 1);
     return this;
   }
@@ -1108,6 +1158,8 @@ ThreadedEmailDisplay = (function(superClass) {
 
 })(BasicEmailDisplay);
 
+ponymail_register_display('threaded', "Threaded view", ThreadedEmailDisplay);
+
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1892,6 +1944,8 @@ BasicListView = (function() {
 
 })();
 
+ponymail_register_listview('default', 'Compact (threaded) theme', BasicListView);
+
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -2237,6 +2291,8 @@ SingleListView = (function(superClass) {
 
 })(BasicListView);
 
+ponymail_register_listview('single', 'Single email theme', SingleListView);
+
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -2531,10 +2587,10 @@ setupAccount = function(json, state) {
 
 /* This is the basic scaffolding for all pages */
 
-listviewScaffolding = function() {
+headerScaffolding = function() {
 
   /* Start off by making the top menu */
-  var calHolder, footer, header, listDiv, logo, mainDiv, menu, r, ul;
+  var logo, menu, ul;
   menu = new HTML('div', {
     id: "topMenu"
   });
@@ -2555,7 +2611,29 @@ listviewScaffolding = function() {
     }
   })));
   ul.inject(logo);
-  menu.inject(ul);
+  return menu.inject(ul);
+};
+
+footerScaffolding = function() {
+
+  /* Add a footer */
+  var footer;
+  footer = new HTML('div', {
+    id: "footer"
+  });
+  document.body.inject(footer);
+  return footer.inject([
+    "Powered by ", new HTML('a', {
+      href: 'https://ponymail.incubator.apache.org/'
+    }, "Apache Pony Mail (Incubating) v/" + ponymail_version), ". Copyright 2016, the Apache
Software Foundation."
+  ]);
+};
+
+listviewScaffolding = function() {
+
+  /* Header scaffolding */
+  var calHolder, header, listDiv, mainDiv, r;
+  headerScaffolding();
 
   /* Now, make the base div */
   mainDiv = new HTML('div', {
@@ -2583,16 +2661,8 @@ listviewScaffolding = function() {
   });
   mainDiv.inject(listDiv);
 
-  /* And of course, a footer */
-  footer = new HTML('div', {
-    id: "footer"
-  });
-  document.body.inject(footer);
-  footer.inject([
-    "Powered by ", new HTML('a', {
-      href: 'https://ponymail.incubator.apache.org/'
-    }, "Apache Pony Mail (Incubating) v/" + ponymail_version), ". Copyright 2016, the Apache
Software Foundation."
-  ]);
+  /* Footer */
+  footerScaffolding();
 
   /* Make an API call to the preferences script, have it call back to listView once done
*/
   return r = new HTTPRequest("api/preferences.lua", {
@@ -2603,6 +2673,41 @@ listviewScaffolding = function() {
   });
 };
 
+
+/* Permalink view callback */
+
+scaffoldingEmailCallback = function(json, state) {
+  e = new ThreadedEmailDisplay(null, null, null, json.thread);
+};
+
+
+/* Permalink view */
+
+threadScaffolding = function() {
+
+  /* Header scaffolding */
+  var mainDiv, mid, r;
+  headerScaffolding();
+
+  /* Now, make the base div */
+  mainDiv = new HTML('div', {
+    id: "email_placeholder",
+    style: {
+      width: "90%"
+    }
+  });
+  document.body.inject(mainDiv);
+
+  /* Footer */
+  footerScaffolding();
+
+  /* Make an API call to the preferences script, have it call back to listView once done
*/
+  mid = location.href.match(/thread\.html\/(.+)/)[1];
+  return r = new HTTPRequest("api/thread.lua?id=" + mid, {
+    callback: scaffoldingEmailCallback
+  });
+};
+
 testCoffee = function() {
 
   /* Get main div from HTML */


Mime
View raw message