Added optional attributes on widgets, form groups and forms to set CSS class of labels and widgets
authorThierry Florac <thierry.florac@onf.fr>
Fri, 12 May 2017 12:32:39 +0200
changeset 201 8d9da7dce6ba
parent 200 3d0098e4fe69
child 202 cc928d5f90d5
Added optional attributes on widgets, form groups and forms to set CSS class of labels and widgets
src/ztfy/myams/templates/forms/form.pt
--- a/src/ztfy/myams/templates/forms/form.pt	Tue Apr 18 11:41:56 2017 +0200
+++ b/src/ztfy/myams/templates/forms/form.pt	Fri May 12 12:32:39 2017 +0200
@@ -66,7 +66,7 @@
 								<tal:if condition="python:widget.mode != 'hidden'">
 									<div tal:define="required python:'required-field' if widget.required and (widget.mode != 'display') else ''"
 										 tal:attributes="class string:form-group ${required}">
-										<label tal:attributes="class view/label_css_class">
+										<label tal:attributes="class widget/label_css_class | group/label_css_class | view/label_css_class">
 											<span>
 												<tal:var content="widget/label" />
 												<i class="fa fa-question-circle hint" title="Input hint"
@@ -76,9 +76,10 @@
 																   data-ams-hint-html python:'<' in description;"></i>
 											</span>
 										</label>
-										<div tal:attributes="class view/input_css_class">
+										<div tal:attributes="class widget/input_css_class | group/input_css_class | view/input_css_class">
 											<label class="input"
-												   tal:attributes="data-ams-data widget/myams:data;
+												   tal:attributes="class widget/widget_css_class | default;
+																   data-ams-data widget/myams:data;
 																   data-ams-form-validator python:view.getWidgetCallback(widget.field.getName())">
 												<input tal:replace="structure widget/render" />
 											</label>