[Mpuls-commits] r3824 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 29 15:44:51 CEST 2010


Author: bh
Date: 2010-09-29 15:44:47 +0200 (Wed, 29 Sep 2010)
New Revision: 3824

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/renderer.py
Log:
Implement mpuls/issue1099

* mpulsweb/lib/renderer.py (ErrorRenderer.render_items): Add
parameter show_undo with default value True.  If show_undo is
true, the method adds an icon with an undo link to each item.
(ErrorRenderer.render): Do not show the undo-link for warnings.
Especially for warnings for missing required fields, undo makes no
sense, as there's nothing to undo.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-29 09:27:22 UTC (rev 3823)
+++ base/trunk/ChangeLog	2010-09-29 13:44:47 UTC (rev 3824)
@@ -1,3 +1,14 @@
+2010-09-29  Bernhard Herzog  <bh at intevation.de>
+
+	Implement mpuls/issue1099
+
+	* mpulsweb/lib/renderer.py (ErrorRenderer.render_items): Add
+	parameter show_undo with default value True.  If show_undo is
+	true, the method adds an icon with an undo link to each item.
+	(ErrorRenderer.render): Do not show the undo-link for warnings.
+	Especially for warnings for missing required fields, undo makes no
+	sense, as there's nothing to undo.
+
 2010-09-29  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	Issue1027:

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-09-29 09:27:22 UTC (rev 3823)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-09-29 13:44:47 UTC (rev 3824)
@@ -1075,10 +1075,12 @@
                                      icon("info/alert.png"), tree))
         out.append(self.render_items(self.warnings, _('Formular warnings'),
                                      icon("info/info.png"), tree,
-                                     css_class='warning-box'))
+                                     css_class='warning-box',
+                                     show_undo=False))
         return "".join(out)
 
-    def render_items(self, items, title, title_icon, tree, css_class=""):
+    def render_items(self, items, title, title_icon, tree, css_class="",
+                     show_undo=True):
         if not items:
             return ""
 
@@ -1099,13 +1101,14 @@
                 values = [values]
             for v in values:
                 out.append('<li>')
-                out.append(tag("a", href=url_for(controller="/formularpage",
-                                                 action="undo", id=k)))
-                out.append(tag("img", src=icon("formular/undo.png"),
-                               border="0", alt="undo",
-                               title=_('Restore last valid value'),
-                               _close=True))
-                out.append('</a>')
+                if show_undo:
+                    out.append(tag("a", href=url_for(controller="/formularpage",
+                                                     action="undo", id=k)))
+                    out.append(tag("img", src=icon("formular/undo.png"),
+                                   border="0", alt="undo",
+                                   title=_('Restore last valid value'),
+                                   _close=True))
+                    out.append('</a>')
                 out.append(tag("a", class_="error", href="#f_%s" % k))
                 out.append("%s:</a>" % escape(description))
                 out.append(" %s" % (escape(v)))



More information about the Mpuls-commits mailing list