summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Yves Chibon <pingou@pingoured.fr>2012-04-11 22:40:21 +0200
committerPierre-Yves Chibon <pingou@pingoured.fr>2012-04-11 22:40:21 +0200
commit70d76981d2c8ec696e0f755c11b1ee05e85a658a (patch)
tree41c591f31171feb360ac0ea67d3f247b7e20196d
parent71ab4141c718ac0bf6eabc3452a1d4d310bca60e (diff)
downloadhyperkitty-70d76981d2c8ec696e0f755c11b1ee05e85a658a.tar.gz
hyperkitty-70d76981d2c8ec696e0f755c11b1ee05e85a658a.tar.xz
hyperkitty-70d76981d2c8ec696e0f755c11b1ee05e85a658a.zip
Make the bar of the plot clickable
-rw-r--r--templates/recent_activities.html17
-rw-r--r--views/pages.py14
2 files changed, 15 insertions, 16 deletions
diff --git a/templates/recent_activities.html b/templates/recent_activities.html
index 7d88aa6..53f0ef9 100644
--- a/templates/recent_activities.html
+++ b/templates/recent_activities.html
@@ -15,6 +15,8 @@
<div id="fig">
<script type="text/javascript+protovis" >
+var dates = ["{{dates_string|join:'","'}}"];
+
var data = {{evolution}},
w = 500,
h = 300,
@@ -31,6 +33,7 @@ var vis = new pv.Panel()
var bar = vis.add(pv.Bar)
.data(data)
+ .event("click", function(n) self.location = "/archives/{{list_address}}/" + dates[this.index])
.left(function() x(this.index))
.width(x.range().band)
.bottom(0)
@@ -42,20 +45,6 @@ var title = vis.add(pv.Label)
.textAlign("center")
.text("Activities on the list over the last 30 days");
-/*
-bar.anchor("top").add(pv.Label)
- .textStyle("white")
- .text(function(d) d.toFixed(1));
-*/
-
-/*
-bar.anchor("bottom").add(pv.Label)
- .textMargin(5)
- .textAlign("right")
- .textBaseline("middle")
- .textAngle(-Math.PI / 2);
-*/
-
vis.add(pv.Rule)
.data(y.ticks())
.bottom(function(d) Math.round(y(d)) - .5)
diff --git a/views/pages.py b/views/pages.py
index 82b4d46..6ed9964 100644
--- a/views/pages.py
+++ b/views/pages.py
@@ -156,7 +156,13 @@ def list(request, mlist_fqdn=None):
cnt = 0
for msg in threads:
msg = Bunch(msg)
- key = '%s%s%s' % (msg.Date.year, msg.Date.month, msg.Date.day)
+ month = msg.Date.month
+ if month < 10:
+ month = '0%s' % month
+ day = msg.Date.day
+ if day < 10:
+ day = '0%s' % day
+ key = '%s%s%s' % (msg.Date.year, month, day)
if key in dates:
dates[key] = dates[key] + 1
else:
@@ -187,6 +193,9 @@ def list(request, mlist_fqdn=None):
# Get the list activity per day
days = dates.keys()
days.sort()
+ dates_string = ["%s/%s/%s" % (key[0:4], key[4:6], key[6:8]) for key in days]
+ #print days
+ #print dates_string
evolution = [dates[key] for key in days]
if not evolution:
evolution.append(0)
@@ -206,7 +215,8 @@ def list(request, mlist_fqdn=None):
'top_author': authors,
'threads_per_category': threads_per_category,
'archives_length': archives_length,
- 'evolution' : evolution,
+ 'evolution': evolution,
+ 'dates_string': dates_string,
})
return HttpResponse(t.render(c))