Override deform template for checkbox field; fix label behavior
This commit is contained in:
parent
0d144ff58b
commit
63e336d4bb
1
setup.py
1
setup.py
|
@ -90,6 +90,7 @@ requires = [
|
||||||
'paginate_sqlalchemy', # 0.2.0
|
'paginate_sqlalchemy', # 0.2.0
|
||||||
'pyramid_beaker>=0.6', # 0.6.1
|
'pyramid_beaker>=0.6', # 0.6.1
|
||||||
'pyramid_debugtoolbar', # 1.0
|
'pyramid_debugtoolbar', # 1.0
|
||||||
|
'pyramid_deform', # 0.2
|
||||||
'pyramid_exclog', # 0.6
|
'pyramid_exclog', # 0.6
|
||||||
'pyramid_mako', # 1.0.2
|
'pyramid_mako', # 1.0.2
|
||||||
'pyramid_simpleform', # 0.6.1
|
'pyramid_simpleform', # 0.6.1
|
||||||
|
|
|
@ -129,6 +129,7 @@ def make_pyramid_config(settings):
|
||||||
if config:
|
if config:
|
||||||
config.set_root_factory(Root)
|
config.set_root_factory(Root)
|
||||||
else:
|
else:
|
||||||
|
settings.setdefault('pyramid_deform.template_search_path', 'tailbone:templates/deform')
|
||||||
config = Configurator(settings=settings, root_factory=Root)
|
config = Configurator(settings=settings, root_factory=Root)
|
||||||
|
|
||||||
# configure user authorization / authentication
|
# configure user authorization / authentication
|
||||||
|
@ -140,6 +141,7 @@ def make_pyramid_config(settings):
|
||||||
|
|
||||||
# Bring in some Pyramid goodies.
|
# Bring in some Pyramid goodies.
|
||||||
config.include('tailbone.beaker')
|
config.include('tailbone.beaker')
|
||||||
|
config.include('pyramid_deform')
|
||||||
config.include('pyramid_mako')
|
config.include('pyramid_mako')
|
||||||
config.include('pyramid_tm')
|
config.include('pyramid_tm')
|
||||||
|
|
||||||
|
|
13
tailbone/templates/deform/checkbox.pt
Normal file
13
tailbone/templates/deform/checkbox.pt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<div class="checkbox">
|
||||||
|
<input tal:define="name name|field.name;
|
||||||
|
true_val true_val|field.widget.true_val;
|
||||||
|
css_class css_class|field.widget.css_class;
|
||||||
|
style style|field.widget.style;
|
||||||
|
oid oid|field.oid"
|
||||||
|
type="checkbox"
|
||||||
|
name="${name}" value="${true_val}"
|
||||||
|
id="${oid}"
|
||||||
|
tal:attributes="checked cstruct == true_val;
|
||||||
|
class css_class;
|
||||||
|
style style;" />
|
||||||
|
</div>
|
|
@ -28,7 +28,7 @@ ${h.csrf_token(request)}
|
||||||
% if field.error:
|
% if field.error:
|
||||||
<div class="field-error">${field.error.msg}</div>
|
<div class="field-error">${field.error.msg}</div>
|
||||||
% endif
|
% endif
|
||||||
<label for="${field.name}">${field.title}</label>
|
<label for="${field.oid}">${field.title}</label>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
${field.serialize()|n}
|
${field.serialize()|n}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue