Author: eallen
Date: 2008-11-08 12:46:25 -0500 (Sat, 08 Nov 2008)
New Revision: 2766
Modified:
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/forms.strings
Log:
Added compact version of FormField. This will display the field title to the left of the
input and on the same line.
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-11-06 22:32:22 UTC (rev 2765)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-11-08 17:46:25 UTC (rev 2766)
@@ -280,6 +280,8 @@
self.__errors = FormErrorSet(app, "errors")
self.add_child(self.__errors)
+ self.css_class = "field"
+
def validate(self, session):
errors = self.__errors.get(session)
@@ -293,6 +295,9 @@
def render_field_help(self, session, *args):
pass
+ def render_form_field_class(self, session, *args):
+ return self.css_class
+
class ScalarField(FormField):
def __init__(self, app, name, input):
super(ScalarField, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.strings 2008-11-06 22:32:22 UTC (rev 2765)
+++ mgmt/trunk/cumin/python/wooly/forms.strings 2008-11-08 17:46:25 UTC (rev 2766)
@@ -72,10 +72,37 @@
div.field div.inputs {
margin: 0 0 1em 1em;
}
+div.field div.clear_left {
+ clear: left;
+}
+/* optional styles for displaying a FormField */
+div.compact {
+ padding: 0;
+ margin: 0;
+}
+div.compact div.title {
+ float: left;
+ margin: 0;
+ width: 6em;
+}
+div.compact div.field_help {
+ font-size: 0.9em;
+ color: #222;
+}
+div.compact div.inputs {
+ margin-left: 1em;
+}
+div.compact.first {
+ margin-top: 1em;
+}
+div.compact.last {
+ margin-bottom: 1em;
+}
+
[FormField.html]
-<div class="field">
- <div class="title">{title}</div> <div
class="field_help">{field_help}</div><div
style="clear:left;"><!-- --></div>
+<div class="{form_field_class}">
+ <div class="title">{title}</div> <div
class="field_help">{field_help}</div><div
class="clear_left"></div>
{errors}
<div class="inputs">{inputs}</div><div
style="clear:left;"><!-- --></div>
</div>
Show replies by date