Sha256: a7f28ef5eabf395fc2f1e3154a2a46e833d4f6a0ae0bd9c5da272ee096964524
Contents?: true
Size: 839 Bytes
Versions: 23
Compression:
Stored size: 839 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.user_search, { ids: element.val() }, function (data) { callback(data.users); }); }, ajax: { url: Spree.routes.user_search, 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
23 entries across 23 versions & 1 rubygems