Sha256: 67695e426987218e49e41d1ccc3d77dffa3c1f0f83eb436ec67703f41ac03537
Contents?: true
Size: 883 Bytes
Versions: 20
Compression:
Stored size: 883 Bytes
Contents
$.fn.userAutocomplete = function () { 'use strict'; this.select2({ minimumInputLength: 1, multiple: true, initSelection: function (element, callback) { $.get(Spree.routes.user_search, { ids: element.val() }, function (data) { callback(data); }); }, 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 }; } }, formatResult: function (user) { return user.email; }, formatSelection: function (user) { return user.email; } }); }; $(document).ready(function () { $('.user_picker').userAutocomplete(); });
Version data entries
20 entries across 20 versions & 1 rubygems