[Jifty-commit] jifty branch, autocomplete-refactor, updated. 6e0a4bd85a6dce697334c3c557212480329eef10

Jifty commits jifty-commit at lists.jifty.org
Wed Mar 24 15:52:48 EDT 2010


The branch, autocomplete-refactor has been updated
       via  6e0a4bd85a6dce697334c3c557212480329eef10 (commit)
      from  1e6ec4bb49ccbed5ca78af3c72220aad7a8b37dc (commit)

Summary of changes:
 share/web/static/js/jifty.js |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 6e0a4bd85a6dce697334c3c557212480329eef10
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Mar 24 15:52:53 2010 -0400

    First cut of parsing the results of autocomplete.xml

diff --git a/share/web/static/js/jifty.js b/share/web/static/js/jifty.js
index 5e9b1c5..9cc9066 100644
--- a/share/web/static/js/jifty.js
+++ b/share/web/static/js/jifty.js
@@ -1736,6 +1736,24 @@ Jifty.addAutocompleter = function (id) {
         mungeData:   function (data, term) {
             return JSON.stringify(data);
         },
+        parse: function (data) {
+            var results = [];
+            jQuery(data).find("li").each(function () {
+                var label = jQuery(this).find(".informal").text();
+                var value = jQuery(this).find(".hidden_value").text();
+
+                if (value == '') {
+                    label = jQuery(this).text();
+                    value = label;
+                }
+
+                results.push({
+                    data:   [value],
+                    result: label
+                });
+            });
+            return results;
+        },
         extraParams: function () {
             var actions = {
                 autocomplete: {

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


More information about the Jifty-commit mailing list