Updated references widgets templates in display mode
authorThierry Florac <tflorac@ulthar.net>
Fri, 26 Jul 2019 12:51:49 +0200
changeset 93 54f4c4134135
parent 92 5449a456e858
child 94 9133137f4fa3
Updated references widgets templates in display mode
src/pyams_sequence/widget/templates/reference-display.pt
src/pyams_sequence/widget/templates/references-list-display.pt
--- a/src/pyams_sequence/widget/templates/reference-display.pt	Mon Mar 18 12:25:35 2019 +0100
+++ b/src/pyams_sequence/widget/templates/reference-display.pt	Fri Jul 26 12:51:49 2019 +0200
@@ -1,25 +1,39 @@
-<input type="hidden" autocomplete="none" readonly
-	tal:attributes="id view/id;
-					name view/name;
-					class string:select2 ${view/klass};
-					style view/style;
-					title view/title;
-					value view/value | nothing;
-					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;
-					accesskey view/accesskey;
-					onselect view/onselect;" />
+<label class="input bordered"
+	   tal:omit-tag="view/required" i18n:domain="pyams_sequence">
+	<div class="select2-parent"
+		 tal:omit-tag="view/required">
+		<input type="hidden" autocomplete="none" readonly disabled="disabled"
+			data-ams-select2-minimum-input-length="2"
+			data-ams-select2-allow-clear="true"
+			data-ams-select2-multiple="true"
+			data-ams-select2-maximum-selection-size="1"
+			data-ams-select2-query-method="findReferences"
+			data-ams-select2-method-target="/api/sequence/json"
+			tal:attributes="id view/id;
+							name view/name;
+							class string:select2 ${view/klass};
+							style view/style;
+							title view/title;
+							value view/value | nothing;
+							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;
+							readonly view/readonly;
+							accesskey view/accesskey;
+							onselect view/onselect;
+							data-ams-select2-values view/values_map;
+							data-ams-select2-query-params view/query_params;" />
+	</div>
+</label>
\ No newline at end of file
--- a/src/pyams_sequence/widget/templates/references-list-display.pt	Mon Mar 18 12:25:35 2019 +0100
+++ b/src/pyams_sequence/widget/templates/references-list-display.pt	Fri Jul 26 12:51:49 2019 +0200
@@ -1,25 +1,37 @@
-<input type="hidden" autocomplete="none" readonly
-	tal:attributes="id view/id;
-					name view/name;
-					class string:select2 ${view/klass};
-					style view/style;
-					title view/title;
-					value view/value | nothing;
-					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;
-					accesskey view/accesskey;
-					onselect view/onselect;" />
+<label class="input bordered"
+	   tal:omit-tag="view/required" i18n:domain="pyams_sequence">
+	<div class="select2-parent"
+		 tal:omit-tag="view/required">
+		<input type="hidden" autocomplete="none" multiple="multiple" disabled="disabled"
+			data-ams-select2-minimum-input-length="2"
+			data-ams-select2-allow-clear="true"
+			data-ams-select2-multiple="true"
+			data-ams-select2-query-method="findReferences"
+			data-ams-select2-method-target="/api/sequence/json"
+			tal:attributes="id view/id;
+							name view/name;
+							class string:select2 ${view/klass};
+							style view/style;
+							title view/title;
+							value view/value | nothing;
+							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;
+							accesskey view/accesskey;
+							onselect view/onselect;
+							data-ams-select2-values view/values_map;
+							data-ams-select2-query-params view/query_params;" />
+	</div>
+</label>
\ No newline at end of file