Sha256: 449a5915fdbd81ffe289eb054c8ba6405d2b7a64c56cadbd8b910795f1e3056d
Contents?: true
Size: 1.25 KB
Versions: 5
Compression:
Stored size: 1.25 KB
Contents
'use strict'; var set_taxon_select = function(){ 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(), token: Spree.api_key }); 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; } }); } } $(document).ready(function () { set_taxon_select() });
Version data entries
5 entries across 5 versions & 1 rubygems