Sha256: 2e2be0e02201b970269f00d46be2f54679fb34d7647436f305b2b25aa772d84e
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
$(document).ready(function () { 'use strict'; if ($('#product_taxon_ids').length > 0) { $('#product_taxon_ids').select2({ placeholder: Spree.translations.taxon_placeholder, multiple: true, initSelection: function (element, callback) { var url = Spree.url(Spree.routes.taxons_search, { ids: element.val() }); return $.getJSON(url, null, function (data) { return callback(data['taxons']); }); }, ajax: { url: Spree.routes.taxons_search, datatype: 'json', data: function (term, page) { return { per_page: 50, page: page, without_children: true, q: { name_cont: term }, token: Spree.api_key }; }, results: function (data, page) { var more = page < data.pages; return { results: data['taxons'], more: more }; } }, formatResult: function (taxon) { return taxon.pretty_name; }, formatSelection: function (taxon) { return taxon.pretty_name; } }); } });
Version data entries
9 entries across 9 versions & 1 rubygems