Sha256: 786a4e374c513f67dffdcb6b4d2ac0d9f269f8c8dbc76712d1fecee8bd05f67c
Contents?: true
Size: 904 Bytes
Versions: 8
Compression:
Stored size: 904 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', params: { "headers": { "X-Spree-Token": Spree.api_key } }, 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
8 entries across 8 versions & 1 rubygems