You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2012/04/01 03:12:43 UTC
svn commit: r1307975 - in
/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets:
templates/widget_timeline.html timeline.py
Author: gjm
Date: Sun Apr 1 01:12:43 2012
New Revision: 1307975
URL: http://svn.apache.org/viewvc?rev=1307975&view=rev
Log:
Dashboard code import: BH_Dashboard: Today and Yesterday labels rendered in activity widget
Modified:
incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html
incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py
Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html?rev=1307975&r1=1307974&r2=1307975&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html Sun Apr 1 01:12:43 2012
@@ -2,7 +2,8 @@
<div id="content" class="timeline"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
- xmlns:xi="http://www.w3.org/2001/XInclude">
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ py:with="today = format_date(today); yesterday = format_date(yesterday)">
<table py:for="day, events in groupby(events, key=lambda e: format_date(e.date))"
class="table table-striped">
Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py?rev=1307975&r1=1307974&r2=1307975&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py Sun Apr 1 01:12:43 2012
@@ -24,7 +24,7 @@ r"""Project dashboard for Apache(TM) Blo
Widgets displaying timeline data.
"""
-from datetime import datetime, date, time
+from datetime import datetime, date, time, timedelta
from itertools import imap, islice
from genshi.builder import tag
@@ -83,8 +83,8 @@ class TimelineWidget(WidgetBase):
start, days, user, precision, filters, count = \
self.bind_params(name, options, *params)
- mockreq = dummy_request(self.env, req.authname)
- mockreq.args = {
+ fakereq = dummy_request(self.env, req.authname)
+ fakereq.args = {
'author' : user or '',
'daysback' : days or '',
'max' : count,
@@ -92,18 +92,20 @@ class TimelineWidget(WidgetBase):
'user' : user
}
if start is not None:
- mockreq.args['from'] = start.strftime('%x %X')
+ fakereq.args['from'] = start.strftime('%x %X')
timemdl = self.env[TimelineModule]
if timemdl is None :
raise TracError('Timeline module not available (disabled?)')
- data = timemdl.process_request(mockreq)[1]
+ data = timemdl.process_request(fakereq)[1]
except TracError, exc:
if data is not None:
exc.title = data.get('title', 'TracReports')
raise
else:
+ data['today'] = today = datetime.now(req.tz)
+ data['yesterday'] = today - timedelta(days=1)
return 'widget_timeline.html', \
{
'title' : _('Activity'),