allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/9] git commit: [#4595] ticket:421 Simple UI for date range filtering
Date Wed, 04 Sep 2013 13:20:21 GMT
Updated Branches:
  refs/heads/master 8b15df901 -> 19070bda3


[#4595] ticket:421 Simple UI for date range filtering


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

Branch: refs/heads/master
Commit: 01194e08c85a00ccd43f903cc546d331cf837930
Parents: 16f3bec
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Sep 2 11:51:00 2013 +0300
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/site_admin.py         | 28 +++++++++++---------
 .../templates/site_admin_new_projects.html      | 11 ++++++--
 2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 7595d66..be8415b 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -181,25 +181,29 @@ class SiteAdminController(object):
 
     @expose('jinja:allura:templates/site_admin_new_projects.html')
     @without_trailing_slash
-    @validate(dict(page=validators.Int(if_empty=0),
-                   limit=validators.Int(if_empty=100)))
-    def new_projects(self, page=0, limit=100, **kwargs):
-        c.page_list = W.page_list
-        c.page_size = W.page_size
-        limit, pagenum, start = g.handle_paging(limit, page, default=100)
-        count = 0
+    def new_projects(self, **kwargs):
+        start_dt = kwargs.pop('start-dt', '')
+        end_dt = kwargs.pop('end-dt', '')
+        try:
+            start_dt = datetime.strptime(start_dt, '%Y/%m/%d %H:%M:%S')
+        except ValueError:
+            start_dt = None
+        try:
+            end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
+        except ValueError:
+            end_dt = None
         nb = M.Neighborhood.query.get(name='Users')
         projects = (M.Project.query.find({
                 'neighborhood_id': {'$ne': nb._id},
                 'deleted': False,
             }).sort('_id', -1))
-        count = projects.count()
-        projects = projects.skip(start).limit(limit)
+        #projects = projects.skip(start).limit(limit)
+        start_dt = datetime.now() if not start_dt else start_dt
+        end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
         return {
             'projects': projects,
-            'limit': limit,
-            'pagenum': pagenum,
-            'count': count
+            'window_start': start_dt,
+            'window_end': end_dt,
         }
 
     @expose('jinja:allura:templates/site_admin_reclone_repo.html')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index 213ab43..a3c0b76 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -20,7 +20,15 @@
 {% extends 'allura:templates/site_admin.html' %}
 
 {% block content %}
-  {{ c.page_size.display(limit=limit, count=count, page=pagenum) }}
+  <div class="grid-24">
+  <form method="GET">
+    <div class="grid-13">
+    <label for="start-dt">From: </label><input type="text" name="start-dt"
id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
+    <label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt"
value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
+    </div>
+    <div class="grid-2"><input type="submit" value="Filter"></div>
+  </form>
+  </div>
   <table>
     <thead>
       <tr>
@@ -51,7 +59,6 @@
     </tr>
     {% endfor %}
   </table>
-  {{ c.page_list.display(limit=limit, count=count, page=pagenum) }}
   <div id="selected-projects"></div>
 {% endblock %}
 


Mime
View raw message