Added optional widget description attribute
authorThierry Florac <thierry.florac@onf.fr>
Mon, 18 Jan 2016 17:52:09 +0100
changeset 37 fe2196a18fae
parent 36 8991b078bd3e
child 38 cdc30169fac1
Added optional widget description attribute
src/pyams_form/templates/form.pt
src/pyams_form/templates/inner-form.pt
src/pyams_form/templates/widget-form.pt
--- a/src/pyams_form/templates/form.pt	Mon Jan 18 17:51:15 2016 +0100
+++ b/src/pyams_form/templates/form.pt	Mon Jan 18 17:52:09 2016 +0100
@@ -13,6 +13,7 @@
 				tal:define="config extension:configuration;">
 				<span class="title" tal:content="view.title | context.title | config.title">Title</span>
 			</h3>
+			<tal:var replace="structure provider:form_toolbar" />
 		</tal:if>
 	</div>
 	<div class="modal-body no-padding">
@@ -61,6 +62,7 @@
 										tal:attributes="class group.css_class;
 														data-ams-checker-fieldname '{0}:list'.format(group.checkbox_widget.name);
 														data-ams-checker-readonly 'readonly' if group.checkbox_widget.mode == 'display' else None;
+														data-ams-checker-mode 'disable' if group.checkbox_mode == 'disable' else None;
 														data-ams-checker-marker '{0}-empty-marker'.format(group.checkbox_widget.name);
 														data-ams-checker-state group.checker_state;">
 									<label tal:content="legend">Legend</label>
@@ -89,7 +91,7 @@
 											<span>
 												<tal:var content="widget.label" />
 												<i class="fa fa-question-circle hint" title="Input hint"
-												   tal:define="description widget.field.description"
+												   tal:define="description getattr(widget, 'description', widget.field.description)"
 												   tal:condition="description"
 												   tal:attributes="title description;
 																   data-ams-hint-html '<' in description;"></i>
--- a/src/pyams_form/templates/inner-form.pt	Mon Jan 18 17:51:15 2016 +0100
+++ b/src/pyams_form/templates/inner-form.pt	Mon Jan 18 17:52:09 2016 +0100
@@ -45,6 +45,7 @@
 								tal:attributes="class group.css_class;
 												data-ams-checker-fieldname '{0}:list'.format(group.checkbox_widget.name);
 												data-ams-checker-readonly 'readonly' if group.checkbox_widget.mode == 'display' else None;
+												data-ams-checker-mode 'disable' if group.checkbox_mode == 'disable' else None;
 												data-ams-checker-marker '{0}-empty-marker'.format(group.checkbox_widget.name);
 												data-ams-checker-state group.checker_state;">
 							<label tal:content="legend">Legend</label>
@@ -73,7 +74,7 @@
 									<span>
 										<tal:var content="widget.label" />
 										<i class="fa fa-question-circle hint" title="Input hint"
-										   tal:define="description widget.field.description"
+										   tal:define="description getattr(widget, 'description', widget.field.description)"
 										   tal:condition="description"
 										   tal:attributes="title description;
 														   data-ams-hint-html '<' in description;"></i>
--- a/src/pyams_form/templates/widget-form.pt	Mon Jan 18 17:51:15 2016 +0100
+++ b/src/pyams_form/templates/widget-form.pt	Mon Jan 18 17:52:09 2016 +0100
@@ -44,6 +44,7 @@
 										tal:attributes="class group.css_class;
 														data-ams-checker-fieldname '{0}:list'.format(group.checkbox_widget.name);
 														data-ams-checker-readonly 'readonly' if group.checkbox_widget.mode == 'display' else None;
+														data-ams-checker-mode 'disable' if group.checkbox_mode == 'disable' else None;
 														data-ams-checker-marker '{0}-empty-marker'.format(group.checkbox_widget.name);
 														data-ams-checker-state group.checker_state;">
 									<label tal:content="legend">Legend</label>
@@ -72,7 +73,7 @@
 											<span>
 												<tal:var content="widget.label" />
 												<i class="fa fa-question-circle hint" title="Input hint"
-												   tal:define="description widget.field.description"
+												   tal:define="description getattr(widget, 'description', widget.field.description)"
 												   tal:condition="description"
 												   tal:attributes="title description;
 																   data-ams-hint-html '<' in description;"></i>