Remove "data-ams-data" attributes from label wrapping widgets
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 May 2017 11:11:32 +0200
changeset 48 13a0658bdc9c
parent 47 d88cb7dfabfc
child 49 db0a295acba3
Remove "data-ams-data" attributes from label wrapping widgets
src/pyams_form/templates/inner-form.pt
src/pyams_form/templates/widget-form.pt
src/pyams_form/widget/configure.zcml
src/pyams_form/widget/templates/object-subform.pt
src/pyams_form/widget/templates/orderedselect-input.pt
src/pyams_form/widget/templates/password-display.pt
src/pyams_form/widget/templates/password-input.pt
src/pyams_form/widget/templates/select-input.pt
src/pyams_form/widget/templates/text-input.pt
--- a/src/pyams_form/templates/inner-form.pt	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/templates/inner-form.pt	Tue May 16 11:11:32 2017 +0200
@@ -83,7 +83,6 @@
 								<div tal:attributes="class widget.input_css_class | group.input_css_class | view.input_css_class">
 									<label class="input"
 										   tal:attributes="class widget.widget_css_class | default;
-														   data-ams-data extension:object_data(widget);
 														   data-ams-form-validator view.get_widget_callback(widget.field.getName())">
 										<input tal:replace="structure widget.render()" />
 									</label>
--- a/src/pyams_form/templates/widget-form.pt	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/templates/widget-form.pt	Tue May 16 11:11:32 2017 +0200
@@ -82,7 +82,6 @@
 										<div tal:attributes="class widget.input_css_class | group.input_css_class | view.input_css_class">
 											<label class="input"
 												   tal:attributes="class widget.widget_css_class | default;
-																   data-ams-data extension:object_data(widget);
 																   data-ams-form-validator view.get_widget_callback(widget.field.getName())">
 												<input tal:replace="structure widget.render()" />
 											</label>
--- a/src/pyams_form/widget/configure.zcml	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/widget/configure.zcml	Tue May 16 11:11:32 2017 +0200
@@ -34,6 +34,12 @@
 
 
 	<z3c:widgetTemplate
+		mode="input"
+		template="templates/text-input.pt"
+		widget="z3c.form.interfaces.ITextWidget"
+		layer="pyams_form.interfaces.form.IFormLayer" />
+
+	<z3c:widgetTemplate
 		mode="display"
 		template="templates/text-display.pt"
 		widget="z3c.form.interfaces.ITextWidget"
@@ -42,6 +48,19 @@
 
 	<z3c:widgetTemplate
 		mode="input"
+		template="templates/password-input.pt"
+		widget="z3c.form.interfaces.IPasswordWidget"
+		layer="pyams_form.interfaces.form.IFormLayer" />
+
+	<z3c:widgetTemplate
+		mode="display"
+		template="templates/password-display.pt"
+		widget="z3c.form.interfaces.IPasswordWidget"
+		layer="pyams_form.interfaces.form.IFormLayer" />
+
+
+	<z3c:widgetTemplate
+		mode="input"
 		template="templates/checkbox-input.pt"
 		widget="z3c.form.interfaces.ICheckBoxWidget"
 		layer="pyams_form.interfaces.form.IFormLayer" />
--- a/src/pyams_form/widget/templates/object-subform.pt	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/widget/templates/object-subform.pt	Tue May 16 11:11:32 2017 +0200
@@ -21,8 +21,7 @@
 					<div class="col-md-9"
 						 tal:attributes="class widget/input_css_class | group/input_css_class | view/input_css_class | default">
 						<label class="input"
-							   tal:attributes="class widget/widget_css_class | default;
-											   data-ams-data extension:object_data(widget);">
+							   tal:attributes="class widget/widget_css_class | default;">
 							<input tal:replace="structure python:widget.render()" />
 						</label>
 					</div>
--- a/src/pyams_form/widget/templates/orderedselect-input.pt	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/widget/templates/orderedselect-input.pt	Tue May 16 11:11:32 2017 +0200
@@ -31,7 +31,8 @@
 								onblur view/onblur;
 								onchange view/onchange;
 								multiple view/multiple;
-								size view/size">
+								size view/size;
+								data-ams-data extension:object_data(view);">
 			<option tal:repeat="entry view/selectedItems"
 					tal:attributes="value entry/value;
 									selected python:entry['value'] in view.value;"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/widget/templates/password-display.pt	Tue May 16 11:11:32 2017 +0200
@@ -0,0 +1,22 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:tal="http://xml.zope.org/namespaces/tal"
+	  tal:omit-tag="">
+	<input type="text" readonly
+		   tal:attributes="id view/id;
+						   class string:${view/klass} border-0;
+						   style view/style;
+						   title view/title;
+						   lang view/lang;
+						   onclick view/onclick;
+						   ondblclick view/ondblclick;
+						   onmousedown view/onmousedown;
+						   onmouseup view/onmouseup;
+						   onmouseover view/onmouseover;
+						   onmousemove view/onmousemove;
+						   onmouseout view/onmouseout;
+						   onkeypress view/onkeypress;
+						   onkeydown view/onkeydown;
+						   onkeyup view/onkeyup;
+						   value view/value;
+						   data-ams-data extension:object_data(view);" />
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/widget/templates/password-input.pt	Tue May 16 11:11:32 2017 +0200
@@ -0,0 +1,38 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:tal="http://xml.zope.org/namespaces/tal"
+	  tal:omit-tag="">
+	<input id="" name="" class="" title="" lang="" disabled=""
+		   readonly="" alt="" tabindex="" accesskey="" size="" maxlength=""
+		   style="" value="" type="password"
+		   tal:attributes="id view/id;
+						   name view/name;
+						   class view/klass;
+						   syle view/style;
+						   title view/title;
+						   lang view/lang;
+						   onclick view/onclick;
+						   ondblclick view/ondblclick;
+						   onmousedown view/onmousedown;
+						   onmouseup view/onmouseup;
+						   onmouseover view/onmouseover;
+						   onmousemove view/onmousemove;
+						   onmouseout view/onmouseout;
+						   onkeypress view/onkeypress;
+						   onkeydown view/onkeydown;
+						   onkeyup view/onkeyup;
+						   value view/value;
+						   disabled view/disabled;
+						   tabindex view/tabindex;
+						   onfocus view/onfocus;
+						   onblur view/onblur;
+						   onchange view/onchange;
+						   readonly view/readonly;
+						   alt view/alt;
+						   accesskey view/accesskey;
+						   onselect view/onselect;
+						   size view/size;
+						   maxlength view/maxlength;
+						   placeholder view/placeholder;
+						   autocapitalize view/autocapitalize;
+						   data-ams-data extension:object_data(view);" />
+</html>
--- a/src/pyams_form/widget/templates/select-input.pt	Sun Feb 26 10:37:14 2017 +0100
+++ b/src/pyams_form/widget/templates/select-input.pt	Tue May 16 11:11:32 2017 +0200
@@ -1,5 +1,5 @@
 <select class="select2"
-		tal:attributes="id view/id;
+		tal:attributes='id view/id;
 						name string:${view/name}:list;
 						class string:${view/klass} select2;
 						style view/style;
@@ -21,7 +21,8 @@
 						onblur view/onblur;
 						onchange view/onchange;
 						multiple view/multiple;
-						size view/size">
+						size view/size;
+						data-ams-data extension:object_data(view);'>
 	<option tal:repeat="entry view/items"
 			tal:attributes="value entry/value;
 						    selected python:entry['value'] in view.value;"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/widget/templates/text-input.pt	Tue May 16 11:11:32 2017 +0200
@@ -0,0 +1,38 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	  xmlns:tal="http://xml.zope.org/namespaces/tal"
+	  tal:omit-tag="">
+	<input id="" name="" class="" title="" lang="" disabled=""
+		   readonly="" alt="" tabindex="" accesskey="" size="" maxlength=""
+		   style="" value="" type="text"
+			tal:attributes="id view/id;
+							name view/name;
+							class view/klass;
+							style view/style;
+							title view/title;
+							lang view/lang;
+							onclick view/onclick;
+							ondblclick view/ondblclick;
+							onmousedown view/onmousedown;
+							onmouseup view/onmouseup;
+							onmouseover view/onmouseover;
+							onmousemove view/onmousemove;
+							onmouseout view/onmouseout;
+							onkeypress view/onkeypress;
+							onkeydown view/onkeydown;
+							onkeyup view/onkeyup;
+							value view/value;
+							disabled view/disabled;
+							tabindex view/tabindex;
+							onfocus view/onfocus;
+							onblur view/onblur;
+							onchange view/onchange;
+							readonly view/readonly;
+							alt view/alt;
+							accesskey view/accesskey;
+							onselect view/onselect;
+							size view/size;
+							maxlength view/maxlength;
+							placeholder view/placeholder;
+							autocapitalize view/autocapitalize;
+							data-ams-data extension:object_data(view);" />
+</html>