[Jifty-commit] jifty branch, autocomplete-refactor, updated. 8410a395217409f301e194b1b770389e4ed2bee5

Jifty commits jifty-commit at lists.jifty.org
Mon Mar 22 16:34:50 EDT 2010


The branch, autocomplete-refactor has been updated
       via  8410a395217409f301e194b1b770389e4ed2bee5 (commit)
      from  d586782303235a95b0b0f7a90431957d84611c3c (commit)

Summary of changes:
 lib/Jifty/Web/Form/Field.pm  |    2 +-
 share/web/static/js/jifty.js |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 8410a395217409f301e194b1b770389e4ed2bee5
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Mar 22 16:33:55 2010 -0400

    First cut of new autocompletion

diff --git a/lib/Jifty/Web/Form/Field.pm b/lib/Jifty/Web/Form/Field.pm
index ac4c4a9..78e7298 100644
--- a/lib/Jifty/Web/Form/Field.pm
+++ b/lib/Jifty/Web/Form/Field.pm
@@ -669,7 +669,7 @@ sub autocomplete_javascript {
     my $self = shift;
     return unless($self->autocompleter);
     my $element_id = $self->element_id;
-    return qq{new Jifty.Autocompleter('$element_id','$element_id-autocomplete')};
+    return "jQuery(document).ready(function(){Jifty.addAutocompleter('#$element_id');});"
 }
 
 =head2 placeholder_javascript
diff --git a/share/web/static/js/jifty.js b/share/web/static/js/jifty.js
index 4f2599b..313f729 100644
--- a/share/web/static/js/jifty.js
+++ b/share/web/static/js/jifty.js
@@ -1722,6 +1722,11 @@ function show_action_result() {
     });
 }
 
+Jifty.addAutocompleter = function (id) {
+    var escaped_id = id.replace(/:/g, '\\\\\\:');
+    jQuery(escaped_id).autocomplete(['foo', 'bar']);
+};
+
 Jifty.Placeholder = function() {
     this.initialize.apply(this, arguments);
     return this;

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list