Author: croberts
Date: 2012-03-19 16:53:45 +0000 (Mon, 19 Mar 2012)
New Revision: 5253
Modified:
trunk/cumin/python/cumin/grid/submission.py
trunk/wooly/python/wooly/forms.py
trunk/wooly/python/wooly/forms.strings
Log:
Addressing BZ 765894 by adding a new "LabelFormField" class that can be used to
display helpful notes or other text on a form without requiring an input of any sort.
This is used to display a note on the VM job submission form indicating that KVM is the
default VM job type.
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2012-03-19 12:01:47 UTC (rev 5252)
+++ trunk/cumin/python/cumin/grid/submission.py 2012-03-19 16:53:45 UTC (rev 5253)
@@ -18,7 +18,7 @@
from wooly import Attribute, Parameter
from wooly.forms import StringField, ScalarField, FormError, OptionInputSet,\
- MultilineStringField, FormField, IntegerField
+ MultilineStringField, FormField, IntegerField, LabelFormField
from wooly.parameters import IntegerParameter
log = logging.getLogger("cumin.grid.submission")
@@ -738,6 +738,9 @@
self.image.required = True
self.add_field(self.image)
+ self.note = self.LabelField(app, "kvmnote")
+ self.add_field(self.note)
+
self.memory = self.MemoryField(app, "memory")
self.memory.required = True
self.add_extra_field(self.memory)
@@ -750,7 +753,7 @@
self.attrs = JobAttributesField(app, "attrs")
self.add_extra_field(self.attrs)
-
+
def process_display(self, session):
self.scheduler.validate(session)
self.memory.set(session, self.app.form_defaults.request_memory_vm)
@@ -778,6 +781,12 @@
self.task.exit_with_redirect(session, scheduler)
+ class LabelField(LabelFormField):
+ ''' this is just text that appears in place of actual form fields
'''
+ def __init__(self, app, name):
+ super(VmJobSubmitForm.LabelField, self).__init__(app, name)
+ self.title = "Note: The default VM job type is KVM."
+
class ImageField(StringField):
def render_title(self, session):
return "Image location"
Modified: trunk/wooly/python/wooly/forms.py
===================================================================
--- trunk/wooly/python/wooly/forms.py 2012-03-19 12:01:47 UTC (rev 5252)
+++ trunk/wooly/python/wooly/forms.py 2012-03-19 16:53:45 UTC (rev 5253)
@@ -363,6 +363,14 @@
def render_help(self, session, *args):
return self.help
+
+class LabelFormField(FormField):
+ def __init__(self, app, name):
+ super(LabelFormField, self).__init__(app, name)
+ self.title = ""
+
+ def render_title(self, session, *args):
+ return self.title
class FormFieldSet(Widget):
def __init__(self, app, name):
Modified: trunk/wooly/python/wooly/forms.strings
===================================================================
--- trunk/wooly/python/wooly/forms.strings 2012-03-19 12:01:47 UTC (rev 5252)
+++ trunk/wooly/python/wooly/forms.strings 2012-03-19 16:53:45 UTC (rev 5253)
@@ -161,6 +161,18 @@
<td>{inputs}</td>
</tr>
+[LabelFormField.css]
+.labeltext {
+ font-size:0.8em;
+}
+
+[LabelFormField.html]
+<tr id="{id}">
+ <td colspan="2">
+ <div class="labeltext">{title}</div>
+ </td>
+</tr>
+
[FormFieldSet.css]
table.FormFieldSet {
width: 100%;
Show replies by date