[Rt-commit] rt branch, 4.0/autocomplete-cf-in-search-builder, created. rt-4.0.11rc1-23-g4ef4186
? sunnavy
sunnavy at bestpractical.com
Fri Oct 4 22:01:13 EDT 2013
The branch, 4.0/autocomplete-cf-in-search-builder has been created
at 4ef418698d79bdbd2e0580c5b1dabfd27ac6003e (commit)
- Log -----------------------------------------------------------------
commit 4ef418698d79bdbd2e0580c5b1dabfd27ac6003e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Apr 3 00:24:55 2013 +0800
autocomplete "Autocomplete cf" in search builder
though we already have Elements/EditCustomFieldAutocomplete, it requires a few
code changes to make it work here, 2 main things:
* current ajax custom field values helper requires context object, which we
don't have one in search builder
* EditCustomFieldAutocomplete is mainly used in objects' edit pages, the input name
isn't compatible here.
making another simpler version(<10 lines) seems more right here.
diff --git a/share/html/Elements/SelectCustomFieldValue b/share/html/Elements/SelectCustomFieldValue
index 3e1bdbe..854f498 100644
--- a/share/html/Elements/SelectCustomFieldValue
+++ b/share/html/Elements/SelectCustomFieldValue
@@ -56,7 +56,17 @@
% }
</select>
% }
-% else {
+% elsif ( $CustomField->Type eq 'Autocomplete' ) {
+<input type="text" id="CF-<% $CustomField->id %>" name="<% $Name %>" size="20" />
+<script type="text/javascript">
+% my @options;
+% my $values = $CustomField->Values;
+% while (my $value = $values->Next) {
+% push @options, $value->Name;
+% }
+jQuery('#'+'CF-' + <% $CustomField->id %>).autocomplete({ source: <% JSON::to_json(\@options) |n %> });
+</script>
+% } else {
<input name="<%$Name%>" size="20" />
% }
<%args>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list