Use new ZTFY data API for text lines widget ZTK-1.1
authorThierry Florac <tflorac@ulthar.net>
Fri, 01 Mar 2013 17:54:40 +0100
branchZTK-1.1
changeset 201 783dcf82b3dc
parent 200 a8bd865a3f1a
child 202 00845ce1f3b4
Use new ZTFY data API for text lines widget
src/ztfy/utils/browser/templates/textlinelist_display.pt
src/ztfy/utils/browser/templates/textlinelist_input.pt
--- a/src/ztfy/utils/browser/templates/textlinelist_display.pt	Fri Mar 01 17:53:43 2013 +0100
+++ b/src/ztfy/utils/browser/templates/textlinelist_display.pt	Fri Mar 01 17:54:40 2013 +0100
@@ -1,37 +1,31 @@
-<tal:if condition="view/value">
-	<input type="text"
-		tal:attributes="id view/id;
-						name view/name;
-						class view/klass;
-						style view/style;
-						title view/title;
-						value view/value;
-						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;
-						accesskey view/accesskey;
-						onselect view/onselect;" />
-	<script type="text/javascript" tal:content="string:
-		$$().ready(function() {
-			$$('INPUT[id=${view/id}]').multiselect({
-				separator: '|',
-				readonly: true
-			});
-		});">
-	</script>
-</tal:if>
+<input type="text"
+	data-ztfy-widget="multiselect"
+	data-multiselect-readonly="true"
+	data-multiselect-separator="|"
+	tal:condition="view/value"
+	tal:attributes="id view/id;
+					name view/name;
+					class view/klass;
+					style view/style;
+					title view/title;
+					value view/value;
+					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;
+					accesskey view/accesskey;
+					onselect view/onselect;" />
 <span tal:condition="not:view/value">--</span>
\ No newline at end of file
--- a/src/ztfy/utils/browser/templates/textlinelist_input.pt	Fri Mar 01 17:53:43 2013 +0100
+++ b/src/ztfy/utils/browser/templates/textlinelist_input.pt	Fri Mar 01 17:54:40 2013 +0100
@@ -1,4 +1,12 @@
-<input type="text"
+<input type="text" autocomplete="off"
+	data-ztfy-widget="multiselect"
+	data-multiselect-class="directory"
+	data-multiselect-separator="|",
+	data-multiselect-max-results="0"
+	data-multiselect-enable-new="true"
+	data-multiselect-search-timeout="1"
+	data-multiselect-complex-search="false"
+	data-multiselect-max-selection-length="1"
 	tal:attributes="id view/id;
 					name view/name;
 					class view/klass;
@@ -25,16 +33,4 @@
 					accesskey view/accesskey;
 					onselect view/onselect;" />
 <input name="field-empty-marker" type="hidden" value="1"
-	   tal:attributes="name string:${view/name}-empty-marker" />
-<script type="text/javascript" tal:content="string:
-	$$().ready(function() {
-		$$('INPUT[id=${view/id}]').multiselect({
-			separator: '|',
-			max_complete_results: 0,
-			enable_new_options: true,
-			on_search_timeout: 0,
-			complex_search: false,
-			input_class: 'directory'
-		});
-	});">
-</script>
\ No newline at end of file
+	   tal:attributes="name string:${view/name}-empty-marker" />
\ No newline at end of file