Sha256: b3c3e41ddc60e6b6e90f96ffffbfde624f9fe7921c861dd9a5faefa77c069553
Contents?: true
Size: 865 Bytes
Versions: 13
Compression:
Stored size: 865 Bytes
Contents
$.fn.userAutocomplete = function () { 'use strict'; function formatUser(user) { return Select2.util.escapeMarkup(user.email); } this.select2({ minimumInputLength: 1, multiple: true, initSelection: function (element, callback) { $.get(Spree.routes.users_api, { ids: element.val(), token: Spree.api_key }, function (data) { callback(data.users); }); }, ajax: { url: Spree.routes.users_api, datatype: 'json', data: function (term) { return { q: term, token: Spree.api_key }; }, results: function (data) { return { results: data.users }; } }, formatResult: formatUser, formatSelection: formatUser }); }; $(document).ready(function () { $('.user_picker').userAutocomplete(); });
Version data entries
13 entries across 13 versions & 1 rubygems