web/views/cwproperties.py
branchstable
changeset 2085 9e279029d7a0
parent 2051 e4d24e4d74e6
child 2133 c3beb65d884d
--- a/web/views/cwproperties.py	Wed Jun 10 08:21:38 2009 +0200
+++ b/web/views/cwproperties.py	Wed Jun 10 12:08:26 2009 +0200
@@ -19,7 +19,7 @@
 from cubicweb.web import uicfg, stdmsgs
 from cubicweb.web.form import FormViewMixIn
 from cubicweb.web.formfields import FIELDS, StringField
-from cubicweb.web.formwidgets import Select, Button, SubmitButton
+from cubicweb.web.formwidgets import Select, TextInput, Button, SubmitButton
 from cubicweb.web.views import primary, formrenderers
 
 
@@ -346,12 +346,13 @@
             else:
                 self.choices = vocab
             wdg = Select()
+        elif pdef['type'] == 'String': # else we'll get a TextArea by default
+            wdg = TextInput()
         else:
-            wdg = FIELDS[pdef['type']].widget()
+            field = FIELDS[pdef['type']]()
+            wdg = field.widget
             if pdef['type'] == 'Boolean':
-                self.choices = [(form.req._('yes'), '1'), (form.req._('no'), '')]
-            elif pdef['type'] in ('Float', 'Int'):
-                wdg.attrs.setdefault('size', 3)
+                self.choices = field.vocabulary(form)
         self.widget = wdg