Sha256: d25992ae5829fb0be5839bf45c7977f5db57d3535d6b5ae830f2e6dbe2511066

Contents?: true

Size: 690 Bytes

Versions: 9

Compression:

Stored size: 690 Bytes

Contents

export default class Default {
  constructor(element, url) {
    this.url = url;
    element.autocomplete(this.options(element));
  }
  options(element) {
    return {
      minLength: 2,
      source: (request, response) => {
        $.getJSON(this.url, {
          q: request.term
        }, response );
      },
      focus: function() {
        // prevent value inserted on focus
        return false;
      },
      complete: function(event) {
        $('.ui-autocomplete-loading').removeClass("ui-autocomplete-loading");
      },
      select: function() {
	  if (element.data('autocomplete-read-only') === true) {
           element.attr('readonly', true);
	}
      }
	
    };
  }
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.1.0 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.5 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.4 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.3 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.2 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.1 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.0.rc2 app/assets/javascripts/hyrax/autocomplete/default.es6
hyrax-1.0.0.rc1 app/assets/javascripts/hyrax/autocomplete/default.es6