feat: allow autocomplete to pass optional params to user.search

v1.18.x
psychobunny 5 years ago
parent f8032cd09b
commit 611f3c6155

@ -5,7 +5,12 @@
define('autocomplete', function () { define('autocomplete', function () {
var module = {}; var module = {};
module.user = function (input, onselect) { module.user = function (input, params, onselect) {
if (typeof params === 'function') {
onselect = params;
params = {};
}
app.loadJQueryUI(function () { app.loadJQueryUI(function () {
input.autocomplete({ input.autocomplete({
delay: 200, delay: 200,
@ -16,10 +21,10 @@ define('autocomplete', function () {
handleOnSelect(input, onselect, event, ui); handleOnSelect(input, onselect, event, ui);
}, },
source: function (request, response) { source: function (request, response) {
socket.emit('user.search', { params.query = params.query || request.term;
query: request.term, params.paginate = params.paginate || false;
paginate: false,
}, function (err, result) { socket.emit('user.search', params, function (err, result) {
if (err) { if (err) {
return app.alertError(err.message); return app.alertError(err.message);
} }

Loading…
Cancel
Save