Author: gjm
Date: Mon Jun 18 10:14:19 2012
New Revision: 1351267
URL: http://svn.apache.org/viewvc?rev=1351267&view=rev
Log:
dashboard: enhancing the widget cloud list view - towards #93 (from olemis)
Modified:
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/widgets/templates/widget_cloud.html
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_cloud.html?rev=1351267&r1=1351266&r2=1351267&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
Mon Jun 18 10:14:19 2012
@@ -1,53 +1,50 @@
-<div id="content" class="${clouddisplay and 'well'}"
+<div id="content" class="${'well' if view == 'cloud' else None}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <py:def function="display_value(value)">
+ <py:choose test="value">
+ <py:when test="None">
+ <span class="label">empty</span>
+ </py:when>
+ <py:when test="''">
+ <span class="label">empty</span>
+ </py:when>
+ <py:otherwise>${value}</py:otherwise>
+ </py:choose>
+ </py:def>
+
<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)}"
- style="font-size: ${int(28 - (13 / (_max - _min)) * (_max -
item[1] - 1) )}px">
- <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>
-
- </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>
+ <py:choose test="view">
+ <py:when test="'cloud'">
+ <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)}"
+ style="font-size: ${int(28 - (13 / (_max - _min)) * (_max -
item[1] - 1) )}px">
+ ${display_value(item[0])}
+ <py:if test="verbose">(${item[1]})</py:if>
+ </a>
+
+ </py:if>
+ </py:for>
+ </py:when>
+ <py:when test="'list'">
+ <ul>
+ <li py:for="item in items" py:if="item[1] > 0">
+ <a href="${item_link(item)}">
+ ${display_value(item[0])}
+ <py:if test="verbose">(${item[1]})</py:if>
+ </a>
+ </li>
+ </ul>
+ </py:when>
+ <py:otherwise>
+ <!--! TODO: Error message: Invalid widget view -->
+ </py:otherwise>
+ </py:choose>
</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=1351267&r1=1351266&r2=1351267&view=diff
==============================================================================
---
incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py
(original)
+++
incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py
Mon Jun 18 10:14:19 2012
@@ -78,10 +78,14 @@ 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,
+ 'view' : {
+ 'desc' : """Display mode. Should be one of the
following
+
+ - `list` : Unordered value list (default)
+ - `cloud` : Similar to tag cloud
+ """,
+ 'default' : 'list',
+ 'type' : EnumField('list', 'cloud'),
},
}
get_widget_params = pretty_wrapper(get_widget_params, check_widget_name)
@@ -91,8 +95,8 @@ class TicketFieldCloudWidget(WidgetBase)
"""
req = context.req
params = ('field', 'query', 'verbose', 'threshold', 'max', 'title',
- 'clouddisplay')
- fieldnm, query, verbose, threshold, maxitems, title, clouddisplay= \
+ 'view')
+ fieldnm, query, verbose, threshold, maxitems, title, view = \
self.bind_params(name, options, *params)
if query is None :
if fieldnm is None:
@@ -201,7 +205,7 @@ class TicketFieldCloudWidget(WidgetBase)
heading=_(fieldnm.capitalize()),
items=items,
verbose=verbose,
- clouddisplay=clouddisplay,
+ view=view,
),
}, \
context