incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1307978 - in /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard: htdocs/bootstrap.css templates/bootstrap_two_col_2_1.html util.py web_ui.py widgets/query.py widgets/report.py widgets/timeline.py
Date Sun, 01 Apr 2012 01:18:38 GMT
Author: gjm
Date: Sun Apr  1 01:18:37 2012
New Revision: 1307978

URL: http://svn.apache.org/viewvc?rev=1307978&view=rev
Log:
Dashboard code import: BH_Dashboard: Added links in widgets header to download widget contents

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/htdocs/bootstrap.css
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bootstrap_two_col_2_1.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.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/timeline.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/htdocs/bootstrap.css
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/htdocs/bootstrap.css?rev=1307978&r1=1307977&r2=1307978&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/htdocs/bootstrap.css (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/htdocs/bootstrap.css Sun Apr
 1 01:18:37 2012
@@ -1739,6 +1739,17 @@ table .span12 {
 .btn-small .icon {
   margin-top: -1px;
 }
+/* <patch> */
+.btn-mini { 
+  font-size: 11px !important;
+  line-height: 14px !important;
+  padding: 2px 6px !important;
+}
+.btn-mini .icon {
+  margin-left: 0px;
+  margin-top: -1px;
+}
+/* </patch> */
 .btn-primary,
 .btn-primary:hover,
 .btn-warning,
@@ -2019,6 +2030,11 @@ button.btn.small, input[type="submit"].b
 .btn-small .caret {
   margin-top: 4px;
 }
+/* <patch> */
+.btn-mini .caret {
+  margin-top: 4px !important;
+}
+/* </patch> */
 .alert {
   padding: 8px 35px 8px 14px;
   margin-bottom: 18px;

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bootstrap_two_col_2_1.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bootstrap_two_col_2_1.html?rev=1307978&r1=1307977&r2=1307978&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bootstrap_two_col_2_1.html
(original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bootstrap_two_col_2_1.html
Sun Apr  1 01:18:37 2012
@@ -16,6 +16,19 @@
         &nbsp;&nbsp;$itm
       </py:for>
     </py:if>
+    &nbsp;&nbsp;
+    <div class="btn-group" py:if="w.altlinks" style="display: inline-block;">
+      <a class="btn btn-mini dropdown-toggle" href="#" data-toggle="dropdown">
+        <i class="icon-download-alt"></i>Download<b class="caret"></b>
+      </a>
+      <ul class="dropdown-menu">
+        <li py:for="idx, link in enumerate(w.altlinks)"
+            class="${first_last(idx, w.altlinks)}">
+          <a rel="nofollow" href="${link.href}" class="link.class"
+              py:content="link.title"></a>
+        </li>
+      </ul>
+    </div>
     <br/>
     ${w.content}
   </div>

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py?rev=1307978&r1=1307977&r2=1307978&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py Sun Apr  1 01:18:37
2012
@@ -66,13 +66,16 @@ def dummy_request(env, uname=None):
     })
     return req
 
-def merge_links(srcreq, dstreq):
+def merge_links(srcreq, dstreq, exclude=None):
     """Incorporate links in `srcreq` into `dstreq`.
     """
+    if exclude is None:
+        exclude = ['alternate']
     if 'links' in srcreq.chrome:
         for rel, links in srcreq.chrome['links'].iteritems():
-            for link in links:
-                add_link(dstreq, rel, **link)
+            if rel not in exclude:
+                for link in links:
+                    add_link(dstreq, rel, **link)
 
 class WidgetBase(Component):
     """Abstract base class for widgets"""

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py?rev=1307978&r1=1307977&r2=1307978&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py Sun Apr  1 01:18:37
2012
@@ -32,9 +32,11 @@ from trac.core import Component, impleme
 from trac.config import Option, IntOption
 from trac.mimeview.api import Context
 from trac.util.translation import _
+from trac.ticket.query import QueryModule
+from trac.ticket.report import ReportModule
 from trac.web.api import IRequestHandler
-from trac.web.chrome import Chrome, INavigationContributor, \
-                            ITemplateProvider, add_stylesheet
+from trac.web.chrome import add_ctxtnav, add_stylesheet, Chrome, \
+                            INavigationContributor, ITemplateProvider
 
 class DashboardModule(Component):
     implements(IRequestHandler, INavigationContributor, ITemplateProvider)
@@ -53,6 +55,10 @@ class DashboardModule(Component):
         """Initially this will render static widgets. With time it will be 
         more and more dynamic and flexible.
         """
+        if self.env[QueryModule] is not None:
+            add_ctxtnav(req, _('Custom Query'), req.href.query())
+        if self.env[ReportModule] is not None:
+            add_ctxtnav(req, _('Reports'), req.href.report())
         add_stylesheet(req, 'dashboard/bootstrap.css')
         return 'bootstrap_two_col_2_1.html', \
                 {
@@ -130,6 +136,7 @@ class DashboardModule(Component):
         data_strm = (w['c'].render_widget(*w['args']) for w in widgets_spec)
         return [{'title' : data['title'], 
                 'content' : render(wctx.req, template, data['data'], fragment=True),
-                'ctxtnav' : data.get('ctxtnav')} \
+                'ctxtnav' : data.get('ctxtnav'), 
+                'altlinks' : data.get('altlinks')} \
                 for template, data, wctx in data_strm]
 

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=1307978&r1=1307977&r2=1307978&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:18:37 2012
@@ -127,7 +127,8 @@ class TicketQueryWidget(WidgetBase):
                         'data' : data,
                         'ctxtnav' : [
                                 tag.a(_('More'), 
-                                    href=req.abs_href.query() + "?" + qstr)]
+                                    href=req.abs_href.query() + "?" + qstr)],
+                        'altlinks' : fakereq.chrome.get('links', {}).get('alternate')
                     }, \
                     qryctx
 

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=1307978&r1=1307977&r2=1307978&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:18:37 2012
@@ -106,7 +106,8 @@ class TicketReportWidget(WidgetBase):
                             tag.a(_('More'), href=req.href('report', rptid)),
                             ('REPORT_MODIFY' in req.perm(rptctx.resource)) and \
                                 tag.a(_('Edit'), href=req.href('report', rptid, action='edit'))
or None,
-                            ]
+                            ],
+                        'altlinks' : fakereq.chrome.get('links', {}).get('alternate')
                     }, \
                     rptctx
 

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=1307978&r1=1307977&r2=1307978&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:18:37 2012
@@ -111,7 +111,8 @@ class TimelineWidget(WidgetBase):
             return 'widget_timeline.html', \
                     {
                         'title' : _('Activity'),
-                        'data' : data
+                        'data' : data, 
+                        'altlinks' : fakereq.chrome.get('links', {}).get('alternate')
                     }, \
                     context
 



Mime
View raw message