[Mpuls-commits] r4944 - in base/trunk/mpulsweb: lib model templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon May 9 11:46:28 CEST 2011
Author: torsten
Date: 2011-05-09 11:46:26 +0200 (Mon, 09 May 2011)
New Revision: 4944
Modified:
base/trunk/mpulsweb/lib/config.py
base/trunk/mpulsweb/model/phase.py
base/trunk/mpulsweb/templates/casemanagement/caselist.mako
Log:
Issue2105: Make display of icons a littlebit more flexible. Does not depend on
description anymore and can be configured now.
Modified: base/trunk/mpulsweb/lib/config.py
===================================================================
--- base/trunk/mpulsweb/lib/config.py 2011-05-09 08:04:19 UTC (rev 4943)
+++ base/trunk/mpulsweb/lib/config.py 2011-05-09 09:46:26 UTC (rev 4944)
@@ -314,6 +314,8 @@
set('phases', 'description', description)
shortdescription = [{'-1': 'U'}]
set('phases', 'shortdescription', description)
+ icons = [{'-1': 'u'}] # letter will be exanded with "running" or "stopped"
+ set('phases', 'icons', icons)
# Phasepairs
pairs =[{"-1": ["-1", "-1"]}]
Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py 2011-05-09 08:04:19 UTC (rev 4943)
+++ base/trunk/mpulsweb/model/phase.py 2011-05-09 09:46:26 UTC (rev 4944)
@@ -301,6 +301,10 @@
desc.append(_('Finished'))
return " ".join(desc)
+ def getIcon(self):
+ icon = g.mpuls_config.get('phases','icons')[0].get(self.phase)
+ return icon or self.getDescription()[0].lower()
+
def load(self, it):
formed = it.getFormEd()
self.it = it
Modified: base/trunk/mpulsweb/templates/casemanagement/caselist.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/caselist.mako 2011-05-09 08:04:19 UTC (rev 4943)
+++ base/trunk/mpulsweb/templates/casemanagement/caselist.mako 2011-05-09 09:46:26 UTC (rev 4944)
@@ -134,8 +134,9 @@
<%def name="get_phase_icon(case)">
<% phase = case.getState().getPhase() %>
<% running = not phase%2 and 'running' or 'finished' %>
- <% description = h.literal(c.phases.get_phase(str(phase)).getDescription())%>
- <img src="${h.url_for(str('/images/icons/case_status/%s_%s.png' % (description[0].lower(), running)) )}" alt="${description}" title="${description}" width="22" height="22">
+ <% description = h.literal(c.phases.get_phase(str(phase)).getDescription()) %>
+ <% icon = c.phases.get_phase(str(phase)).getIcon() %>
+ <img src="${h.url_for(str('/images/icons/case_status/%s_%s.png' % (icon, running)) )}" alt="${description}" title="${description}" width="22" height="22">
</%def>
<%def name="render_phase_legend()">
More information about the Mpuls-commits
mailing list