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/06/01 18:42:07 UTC

svn commit: r1345273 - in /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard: layouts/templates/widget_macros.html widgets/templates/widget_cloud.html widgets/ticket.py

Author: gjm
Date: Fri Jun  1 16:42:06 2012
New Revision: 1345273

URL: http://svn.apache.org/viewvc?rev=1345273&view=rev
Log:
dashboard: allow widget cloud to optionally display as list (list being default) or the cloud - towards #93

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html?rev=1345273&r1=1345272&r2=1345273&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html Fri Jun  1 16:42:06 2012
@@ -8,7 +8,7 @@
   <!--! Helper functions (py:def) -->
 
   <div py:def="widget_container(w)" role="application">
-    <h1 style="display: inline;">${w.title}</h1>
+    <h3 style="display: inline;">${w.title}</h3>
     <py:if test="w.ctxtnav">
       <py:for each="itm in w.ctxtnav">
         &nbsp;&nbsp;$itm

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html?rev=1345273&r1=1345272&r2=1345273&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html Fri Jun  1 16:42:06 2012
@@ -1,15 +1,16 @@
 
-<div id="content" class="well"
+<div id="content" class="${clouddisplay and 'well'}"
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:py="http://genshi.edgewall.org/"
   xmlns:xi="http://www.w3.org/2001/XInclude">
 
   <h3 style="display: inline;">$heading</h3>
   <p style="font-size: medium; line-height: 150%;">
+    <py:if test='clouddisplay'>
     <py:for each="item in items"
         py:with="_max = bounds.max + 1; _min = bounds.min" >
       <py:if test="item[1] > 0">
-        <a href="${item_link(item)}" 
+        <a href="${item_link(item)}"
             style="font-size: ${int(28 - (13 / (_max - _min)) * (_max - item[1] - 1) )}px">
           <py:choose test="item[0]">
             <py:when test="None">
@@ -25,5 +26,28 @@
         &nbsp;&nbsp;
       </py:if>
     </py:for>
+    </py:if>
+    <py:if test='not clouddisplay'>
+    <ul>
+    <py:for each="item in items">
+      <py:if test="item[1] > 0">
+        <li>
+        <a href="${item_link(item)}">
+          <py:choose test="item[0]">
+            <py:when test="None">
+              <span class="label">empty</span>
+            </py:when>
+            <py:when test="''">
+              <span class="label">empty</span>
+            </py:when>
+            <py:otherwise>${item[0]}</py:otherwise>
+          </py:choose>
+          <py:if test="verbose">(${item[1]})</py:if>
+        </a>
+        </li>
+      </py:if>
+    </py:for>
+    </ul>
+    </py:if>
   </p>
 </div>

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py?rev=1345273&r1=1345272&r2=1345273&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py Fri Jun  1 16:42:06 2012
@@ -78,6 +78,11 @@ class TicketFieldCloudWidget(WidgetBase)
                         'desc' : """Limit the number of items displayed""",
                         'type' : int
                     },
+                'clouddisplay' : {
+                        'desc' : """Display as cloud if true else as a list""",
+                        'default' : False,
+                        'type' : bool,
+                    },
             }
     get_widget_params = pretty_wrapper(get_widget_params, check_widget_name)
 
@@ -85,8 +90,9 @@ class TicketFieldCloudWidget(WidgetBase)
         """Count ocurrences of values assigned to given ticket field.
         """
         req = context.req
-        params = ('field', 'query', 'verbose', 'threshold', 'max', 'title')
-        fieldnm, query, verbose, threshold, maxitems, title = \
+        params = ('field', 'query', 'verbose', 'threshold', 'max', 'title',
+                  'clouddisplay')
+        fieldnm, query, verbose, threshold, maxitems, title, clouddisplay= \
                 self.bind_params(name, options, *params)
         if query is None :
             if fieldnm is None:
@@ -194,7 +200,8 @@ class TicketFieldCloudWidget(WidgetBase)
                             item_link= item_link,
                             heading=_(fieldnm.capitalize()),
                             items=items,
-                            verbose=verbose
+                            verbose=verbose,
+                            clouddisplay=clouddisplay,
                         ), 
                 }, \
                 context