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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jun 29 20:11:05 CEST 2010


Author: bh
Date: 2010-06-29 20:11:03 +0200 (Tue, 29 Jun 2010)
New Revision: 3101

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._renderRadio): Make it
actually work.  Doesn't look as nice as in WASKO 1.7, currently,
though.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-06-29 07:40:36 UTC (rev 3100)
+++ base/trunk/ChangeLog	2010-06-29 18:11:03 UTC (rev 3101)
@@ -1,3 +1,9 @@
+2010-06-29  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (ViewRenderer._renderRadio): Make it
+	actually work.  Doesn't look as nice as in WASKO 1.7, currently,
+	though.
+
 2010-06-22  Roland Geider <roland.geider at intevation.de>
 	
 	* impulsweb/i18n/mpulsweb.pot,

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-06-29 07:40:36 UTC (rev 3100)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-06-29 18:11:03 UTC (rev 3101)
@@ -570,20 +570,27 @@
 
     def _renderRadio(self, node):
         meta = self._getMeta(node)
-        self.stateStack.append(node.getValue())
+        id = node.getIdentifier()
+        current_value = str(node.getValue())
         out = []
-        for child in node.getChildren():
-            id = child.getIdentifier()
-            value = self._getMeta(child).getValue()
-            out.append(tag("input", type="radio", id=id, name=id,
+        out.append(self._renderLabel(node))
+        out.append(self._renderAttributes(node))
+        out.append("<br>\n")
+        for child in meta.getChildren():
+            value = child.getValue()
+            radio_id = child.getName()
+            out.append(tag("input", type="radio", id=radio_id, name=id,
                            value=value, disabled=self.ro_mode,
-                           checked=self.stateStack[-1] == value,
+                           checked=(current_value == value),
                            tabindex=self.next_tabindex(),
                            **SET_MODIFICATION_ATTRS))
-            out.append(self._renderLabel(child))
-            out.append(self._renderAttributes(child))
-            out.append('<br>')
-        self.stateStack.pop()
+            out.append(" ")
+            out.append(tag("label", for_=radio_id))
+            out.append(tag("a", name="f_" + radio_id))
+            out.append(escape(child.getDescription()))
+            out.append("</a>")
+            out.append("</label>")
+            out.append('<br>\n')
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
 



More information about the Mpuls-commits mailing list