Sha256: cd936efa6ea14f51e00a54d62c15a6d86f1176b6c8424056239cde8409f106ec
Contents?: true
Size: 767 Bytes
Versions: 16
Compression:
Stored size: 767 Bytes
Contents
$.fn.userAutocomplete = function () { 'use strict' function formatUserList(values) { return values.map(function (obj) { return { id: obj.id, text: obj.attributes.email } }) } this.select2({ multiple: true, minimumInputLength: 1, ajax: { url: Spree.routes.users_api_v2, dataType: 'json', headers: Spree.apiV2Authentication(), data: function (params) { return { filter: { email_i_cont: params.term } } }, processResults: function(data) { return { results: formatUserList(data.data) } } } }) } document.addEventListener("spree:load", function() { $('.user_picker').userAutocomplete() })
Version data entries
16 entries across 16 versions & 1 rubygems