ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject incubator-ponymail git commit: auto-compute how many results per page based on window height
Date Mon, 05 Sep 2016 14:56:27 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/coffee-and-cake 30a6a077e -> de3d4ca8b


auto-compute how many results per page based on window height


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

Branch: refs/heads/coffee-and-cake
Commit: de3d4ca8bec4c5bb16c4cded0814b764c00ad2e3
Parents: 30a6a07
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Mon Sep 5 16:56:14 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Mon Sep 5 16:56:14 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview_basic.coffee | 7 ++++++-
 site/js/ponymail-coffee.js           | 8 +++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/de3d4ca8/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index d1f075e..cb48b68 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -20,8 +20,13 @@
 ###
 class BasicListView
     ### json: from stats.lua, rpp = results per page, pos = starting position (from 0) ###
-    constructor: (@json, @rpp = 15, @pos = 0) ->
+    constructor: (@json, @rpp = 0, @pos = 0) ->
         
+        ### @rpp == 0 == auto-compute num of items ###
+        if @rpp == 0
+            @rpp= Math.max( parseInt((window.innerHeight - 300) / 40), 5)
+            @rpp = @rpp - (@rpp % 5)
+            
         ### Set the header first ###
         hd = get('header')
         if @json.list

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/de3d4ca8/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index 040a94b..ac26cb0 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -1318,9 +1318,15 @@ BasicListView = (function() {
   function BasicListView(json1, rpp1, pos1) {
     var date, hd, m, ref, y;
     this.json = json1;
-    this.rpp = rpp1 != null ? rpp1 : 15;
+    this.rpp = rpp1 != null ? rpp1 : 0;
     this.pos = pos1 != null ? pos1 : 0;
 
+    /* @rpp == 0 == auto-compute num of items */
+    if (this.rpp === 0) {
+      this.rpp = Math.max(parseInt((window.innerHeight - 300) / 40), 5);
+      this.rpp = this.rpp - (this.rpp % 5);
+    }
+
     /* Set the header first */
     hd = get('header');
     if (this.json.list) {


Mime
View raw message