o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1366143855.518173:@value"s	{I"
class:EFI"ProcessedAsset;�FI"logical_path;�FI""umlaut/search_autocomplete.js;�TI"
pathname;�FI"O/home/rochkind/umlaut/app/assets/javascripts/umlaut/search_autocomplete.js;�TI"content_type;�FI"application/javascript;�FI"
mtime;�FI"2013-04-16T14:58:35-04:00;�FI"length;�Fi_I"digest;�F"%c418a789004a1ab8510b2263a2f2e701I"source;�FI"_/* search_autocomplete.js.  Add autocomplete to Umlaut journal title search. */

jQuery(document).ready(function($) {
    
    $(document).on("submit", "form.OpenURL", function() {
       var form = $(this);
       if ( form.find(".rft_title").val() != $(this).val()) {
          form.find(".rft_object_id").val("");
          form.find(".rft_title").val("");
       }
    });
    
  $("input.title_search").autocomplete({
            minLength: 3,
            source: function(request, response) {              
              var form = $(this.element).closest("form");
              $.ajax({
                  url: form.attr("action").replace("journal_search", "auto_complete_for_journal_title"),
                  dataType: "json",
                  data: form.serialize(),
                  success: function(data) {
                    response($.map(data, function(item) {
                      return {
                        label: item.title,
                        id: item.object_id
                      }
                    }));
                  }
              });
            },
            select: function(event, ui) {
              var form = $(event.target).closest("form");
              
              form.find("input.rft_object_id").val(ui.item.id);
              form.find("input.rft_title").val( ui.item.label );
              form.find("select.sfx_title_search").val("exact");
            }
          });
  
});


/*					select: function(event, ui) {
						log(ui.item ? ("Selected: " + ui.item.value + ", geonameId: " + ui.item.id) : "Nothing selected, input was " + this.value);
					}
				});
*/
;
;�FI"dependency_digest;�F"%d537b153a9faa5685cac3bba35e11259I"required_paths;�F[I"O/home/rochkind/umlaut/app/assets/javascripts/umlaut/search_autocomplete.js;�TI"dependency_paths;�F[{I"	path;�FI"O/home/rochkind/umlaut/app/assets/javascripts/umlaut/search_autocomplete.js;�TI"
mtime;�FI"2013-04-16T14:58:35-04:00;�FI"digest;�F"%2b762a7bfd74fb861445f8232a110b83I"
_version;�F"%6776f581a4329e299531e1d52aa59832