incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#6545] add forum selector
Date Fri, 06 Sep 2013 21:53:25 GMT
Updated Branches:
  refs/heads/db/6545 531d571de -> e3ffe804c


[#6545] add forum selector


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

Branch: refs/heads/db/6545
Commit: e3ffe804c647f9f106dda4f3caed1186b1a5a240
Parents: 531d571
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri Sep 6 21:43:13 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Sep 6 21:43:13 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/site_style.css         |  3 +--
 .../forgediscussion/controllers/root.py            |  8 +++++---
 .../templates/discussionforums/stats_graph.html    | 17 ++++++++++++++++-
 3 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3ffe804/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index b85f54d..acee986 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2609,7 +2609,6 @@ div.attachment_thumb .file_type span {
 /* Stats Graph */
 
 #stats_date_picker {
-  text-align: right;
   width: 340px;
   display: inline;
   float: left;
@@ -2618,7 +2617,7 @@ div.attachment_thumb .file_type span {
   margin: 0 10px;
 }
 #stats_date_picker input {
-  width: 228px !important;
+  width: 14em;
 }
 
 #stats-viz-container {

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3ffe804/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 9250ad0..fdf8f11 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -216,13 +216,14 @@ class RootController(BaseController, DispatchIndex, FeedController):
 
     @without_trailing_slash
     @expose('jinja:forgediscussion:templates/discussionforums/stats_graph.html')
-    def stats(self, dates=None, **kw):
+    def stats(self, dates=None, forum=None, **kw):
         if not dates:
             dates = "{} to {}".format(
                 (date.today() - timedelta(days=60)).strftime('%Y-%m-%d'),
                 date.today().strftime('%Y-%m-%d'))
         return dict(
             dates=dates,
+            selected_forum=forum,
         )
 
     @expose('json')
@@ -230,12 +231,13 @@ class RootController(BaseController, DispatchIndex, FeedController):
         begin=h.DateTimeConverter(if_empty=None, if_invalid=None),
         end=h.DateTimeConverter(if_empty=None, if_invalid=None),
     ))
-    def stats_data(self, begin=None, end=None, **kw):
+    def stats_data(self, begin=None, end=None, forum=None, **kw):
         end = end or date.today()
         begin = begin or end - timedelta(days=60)
 
         discussion_id_q = {
-            '$in': [d._id for d in c.app.forums]
+            '$in': [d._id for d in c.app.forums
+                    if d.shortname == forum or forum is None]
         }
         # must be ordered dict, so that sorting by this works properly
         grouping = OrderedDict()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3ffe804/ForgeDiscussion/forgediscussion/templates/discussionforums/stats_graph.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/stats_graph.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/stats_graph.html
index 39e4ef8..d702657 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/stats_graph.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/stats_graph.html
@@ -28,6 +28,15 @@
     <label for="dates">Date Range: </label>
     <input value="{{dates}}" type="text" class="text ui-corner-all" name="dates" id="dates">
   </div>
+  <label for="forum">Forum:</label>
+  <select name="forum">
+    <option value="">All</option>
+    {% for forum in c.app.forums %}
+        <option value="{{forum.shortname}}"
+          {%- if forum.shortname == selected_forum %} selected{% endif -%}
+          >{{forum.name}}</option>
+    {% endfor %}
+  </select>
 </form>
 
 <div id="stats-viz-container" class="project_stats">
@@ -82,7 +91,13 @@
     var checkEmpty = function(data){
       return !data.length;
     };
-    chartProjectStats('{{c.app.url}}stats_data',{},series,checkEmpty);
+    chartProjectStats('{{c.app.url}}stats_data',
+                      {forum: $('select[name=forum]').val()},
+                      series, checkEmpty);
+
+    $('select[name=forum]').change(function(){
+        $(this).parent('form').submit();
+    });
   });
 </script>
 {% endblock %}
\ No newline at end of file


Mime
View raw message