Added checkbox templates
authorThierry Florac <tflorac@ulthar.net>
Sat, 28 Feb 2015 15:13:47 +0100
changeset 4 7d4e3da55ba1
parent 3 9dbd2ca24a55
child 5 95b0c8d43b47
Added checkbox templates
src/pyams_form/widget/configure.zcml
src/pyams_form/widget/templates/checkbox-display.pt
src/pyams_form/widget/templates/checkbox-input.pt
--- a/src/pyams_form/widget/configure.zcml	Sat Feb 28 15:12:48 2015 +0100
+++ b/src/pyams_form/widget/configure.zcml	Sat Feb 28 15:13:47 2015 +0100
@@ -42,6 +42,19 @@
 
 	<z3c:widgetTemplate
 		mode="input"
+		template="templates/checkbox-input.pt"
+		widget="z3c.form.interfaces.ICheckBoxWidget"
+		layer="pyams_form.interfaces.form.IFormLayer" />
+
+	<z3c:widgetTemplate
+		mode="display"
+		template="templates/checkbox-display.pt"
+		widget="z3c.form.interfaces.ICheckBoxWidget"
+		layer="pyams_form.interfaces.form.IFormLayer" />
+
+
+	<z3c:widgetTemplate
+		mode="input"
 		template="templates/radio-input.pt"
 		widget="z3c.form.interfaces.IRadioWidget"
 		layer="pyams_form.interfaces.form.IFormLayer" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/widget/templates/checkbox-display.pt	Sat Feb 28 15:13:47 2015 +0100
@@ -0,0 +1,65 @@
+<i18n:var domain="pyams_form">
+	<label class="checkbox" tal:define="items view/items">
+		<input name="field-empty-marker" type="hidden" value="1"
+				tal:attributes="name string:${view/name}-empty-marker" />
+		<tal:loop repeat="item items">
+			<input type="checkbox" id="" name="" class="" alt="" title=""
+				   tabindex="" accesskey="" value="" disabled
+				   checked="checked"
+				tal:condition="item/checked"
+				tal:attributes="id item/id;
+								name item/name;
+								class view/klass;
+								value item/value;
+								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;
+								tabindex view/tabindex;
+								onfocus view/onfocus;
+								onblur view/onblur;
+								onchange view/onchange;
+								alt view/alt;
+								accesskey view/accesskey;
+								onselect view/onselect" />
+			<input id="" name="" class="" alt="" title="" tabindex=""
+				   accesskey="" value="" disabled
+				   type="checkbox"
+				tal:condition="not:item/checked"
+				tal:attributes="id item/id;
+								name item/name;
+								class view/klass;
+								value item/value;
+								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;
+								tabindex view/tabindex;
+								onfocus view/onfocus;
+								onblur view/onblur;
+								onchange view/onchange;
+								alt view/alt;
+								accesskey view/accesskey;
+								onselect view/onselect" />
+			<i></i><span tal:replace="item/label" i18n:translate="">Label</span>
+		</tal:loop>
+	</label>
+</i18n:var>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/widget/templates/checkbox-input.pt	Sat Feb 28 15:13:47 2015 +0100
@@ -0,0 +1,69 @@
+<i18n:var domain="pyams_form">
+	<label class="checkbox" tal:define="items view/items">
+		<input name="field-empty-marker" type="hidden" value="1"
+				tal:attributes="name string:${view/name}-empty-marker" />
+		<tal:loop repeat="item items">
+			<input type="checkbox" id="" name="" class="" alt="" title=""
+				   tabindex="" disabled="" readonly="" accesskey="" value=""
+				   checked="checked"
+				tal:condition="item/checked"
+				tal:attributes="id item/id;
+								name item/name;
+								class view/klass;
+								value item/value;
+								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;
+								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" />
+			<input id="" name="" class="" alt="" title="" tabindex=""
+				   disabled="" readonly="" accesskey="" value=""
+				   type="checkbox"
+				tal:condition="not:item/checked"
+				tal:attributes="id item/id;
+								name item/name;
+								class view/klass;
+								value item/value;
+								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;
+								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" />
+			<i></i><span tal:replace="item/label" i18n:translate="">Label</span>
+		</tal:loop>
+	</label>
+</i18n:var>