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:17:38 UTC

svn commit: r1307977 - in /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard: util.py widgets/query.py widgets/report.py widgets/templates/widget_grid.html widgets/timeline.py

Author: gjm
Date: Sun Apr  1 01:17:37 2012
New Revision: 1307977

URL: http://svn.apache.org/viewvc?rev=1307977&view=rev
Log:
Dashboard code import: BH_Dashboard: Colors for reports and styles for timeline

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/query.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/report.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_grid.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py?rev=1307977&r1=1307976&r2=1307977&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py Sun Apr  1 01:17:37 2012
@@ -32,7 +32,7 @@ from wsgiref.util import setup_testing_d
 
 from trac.core import Component, implements
 from trac.web.api import Request
-from trac.web.chrome import Chrome
+from trac.web.chrome import add_link, Chrome
 from trac.web.main import RequestDispatcher
 
 from bhdashboard.api import DashboardSystem, IWidgetProvider, InvalidIdentifier
@@ -66,6 +66,13 @@ def dummy_request(env, uname=None):
     })
     return req
 
+def merge_links(srcreq, dstreq):
+    """Incorporate links in `srcreq` into `dstreq`.
+    """
+    if 'links' in srcreq.chrome:
+        for rel, links in srcreq.chrome['links'].iteritems():
+            for link in links:
+                add_link(dstreq, rel, **link)
 
 class WidgetBase(Component):
     """Abstract base class for widgets"""

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/query.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/query.py?rev=1307977&r1=1307976&r2=1307977&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/query.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/query.py Sun Apr  1 01:17:37 2012
@@ -38,7 +38,8 @@ from trac.web.api import RequestDone
 
 from bhdashboard.util import WidgetBase, InvalidIdentifier, \
                               check_widget_name, dummy_request, \
-                              pretty_wrapper, trac_version, trac_tags
+                              merge_links, pretty_wrapper, trac_version, \
+                              trac_tags
 
 class TicketQueryWidget(WidgetBase):
     """Display tickets matching a TracQuery using a grid
@@ -95,6 +96,7 @@ class TicketQueryWidget(WidgetBase):
                 exc.title = data.get('title', 'TracQuery')
             raise
         else:
+            merge_links(srcreq=fakereq, dstreq=req)
             qryctx = Context.from_request(fakereq)
             query = data['query']
             idxs = count()

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/report.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/report.py?rev=1307977&r1=1307976&r2=1307977&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/report.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/report.py Sun Apr  1 01:17:37 2012
@@ -37,7 +37,8 @@ from trac.web.api import RequestDone
 
 from bhdashboard.util import WidgetBase, InvalidIdentifier, \
                               check_widget_name, dummy_request, \
-                              pretty_wrapper, trac_version, trac_tags
+                              merge_links, pretty_wrapper, trac_version, \
+                              trac_tags
 
 class TicketReportWidget(WidgetBase):
     """Display tickets in saved report using a grid
@@ -94,6 +95,7 @@ class TicketReportWidget(WidgetBase):
                 exc.title = data.get('title', 'TracReports')
             raise
         else:
+            merge_links(srcreq=fakereq, dstreq=req)
             title = data.get('title', '%s {%s}' % (_('Report'), rptid))
             rptctx = Context.from_request(fakereq, 'report', rptid)
             return 'widget_grid.html', \

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_grid.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_grid.html?rev=1307977&r1=1307976&r2=1307977&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_grid.html (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_grid.html Sun Apr  1 01:17:37 2012
@@ -17,7 +17,7 @@
     <div py:when="numrows" class="numrows">($numrows total rows)</div>
   </py:choose>
 
-  <table class="table table-condensed" 
+  <table class="table table-condensed tickets" 
       py:with="use_groups = len(row_groups) &gt; 1 or row_groups[0][0] is not None">
     <thead>
       <tr py:for="header_group in header_groups">
@@ -40,7 +40,7 @@
             }${'__style__' in row and row.__style__+';' or None
             }${fullrow and 'border: none; padding: 0;' or None}">
 
-            <td py:if="use_groups" style="background: none; color: #333333;">
+            <td py:if="use_groups" style="background: none repeat scroll 0 0 #FFFFFF; color: #333333;">
               <py:if test="idx == 0">$value_for_group</py:if>
             </td>
             <py:for each="cell in cell_group">

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=1307977&r1=1307976&r2=1307977&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:17:37 2012
@@ -35,7 +35,8 @@ from trac.util.translation import _
 from bhdashboard.api import DateField, EnumField, ListField
 from bhdashboard.util import WidgetBase, InvalidIdentifier, \
                               check_widget_name, dummy_request, \
-                              pretty_wrapper, trac_version, trac_tags
+                              merge_links, pretty_wrapper, trac_version, \
+                              trac_tags
 
 class TimelineWidget(WidgetBase):
     """Display activity feed.
@@ -104,6 +105,7 @@ class TimelineWidget(WidgetBase):
                 exc.title = data.get('title', 'TracReports')
             raise
         else:
+            merge_links(srcreq=fakereq, dstreq=req)
             data['today'] = today = datetime.now(req.tz)
             data['yesterday'] = today - timedelta(days=1)
             return 'widget_timeline.html', \