Sha256: 25f04d211aa84d094c069a8e33d563ea0e292da29c3b5d5e3e51deb4c119f9f8

Contents?: true

Size: 1.58 KB

Versions: 31

Compression:

Stored size: 1.58 KB

Contents

/* search_autocomplete.js.  Add autocomplete to Umlaut journal title search. */
jQuery(document).ready(function($) {
    
    $("form.OpenURL").live("submit", 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);
					}
				});
*/

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
umlaut-3.0.4 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.3 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.2 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.1 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0rc1 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta10 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta9 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta8 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta7 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta6 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta5 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta4 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta3 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta2 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0beta1 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0alpha15 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0alpha14 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0alpha13 app/assets/javascripts/umlaut/search_autocomplete.js
umlaut-3.0.0alpha12 app/assets/javascripts/umlaut/search_autocomplete.js