Sha256: 3cd661c38339f4f82ba7644191a86df8e12989c06e46eb500c624e0b893988f8
Contents?: true
Size: 786 Bytes
Versions: 13
Compression:
Stored size: 786 Bytes
Contents
$.fn.taxonAutocomplete = function() { 'use strict' function formatTaxonList(values) { return values.map(function (obj) { return { id: obj.id, text: obj.pretty_name } }) } this.select2({ multiple: true, placeholder: Spree.translations.taxon_placeholder, minimumInputLength: 2, ajax: { url: Spree.routes.taxons_api, dataType: 'json', data: function (params) { return { q: { name_cont: params.term, }, token: Spree.api_key } }, processResults: function(data) { return { results: formatTaxonList(data.taxons) } } } }) } $(document).ready(function () { $('#product_taxon_ids').taxonAutocomplete() })
Version data entries
13 entries across 13 versions & 1 rubygems