web/views/formrenderers.py
changeset 2819 b864288fd316
parent 2656 a93ae0f6c0ad
child 2890 fdcb8a2bb6eb
equal deleted inserted replaced
2818:326375561412 2819:b864288fd316
    13 from simplejson import dumps
    13 from simplejson import dumps
    14 
    14 
    15 from cubicweb.common import tags
    15 from cubicweb.common import tags
    16 from cubicweb.appobject import AppObject
    16 from cubicweb.appobject import AppObject
    17 from cubicweb.selectors import entity_implements, yes
    17 from cubicweb.selectors import entity_implements, yes
    18 from cubicweb.web import eid_param
    18 from cubicweb.web import eid_param, formwidgets as fwdgs
    19 from cubicweb.web import formwidgets as fwdgs
       
    20 from cubicweb.web.widgets import checkbox
       
    21 from cubicweb.web.formfields import HiddenInitialValueField
    19 from cubicweb.web.formfields import HiddenInitialValueField
       
    20 
       
    21 def checkbox(name, value, attrs='', checked=None):
       
    22     if checked is None:
       
    23         checked = value
       
    24     checked = checked and 'checked="checked"' or ''
       
    25     return u'<input type="checkbox" name="%s" value="%s" %s %s />' % (
       
    26         name, value, checked, attrs)
    22 
    27 
    23 
    28 
    24 class FormRenderer(AppObject):
    29 class FormRenderer(AppObject):
    25     """basic renderer displaying fields in a two columns table label | value
    30     """basic renderer displaying fields in a two columns table label | value
    26 
    31