From 536c443c1ec622dda88d406715e09cf4a777f3a9 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 15 Jun 2015 16:03:38 -0400 Subject: [PATCH] closes #3231 --- public/src/admin/manage/category.js | 10 ++++------ public/src/modules/autocomplete.js | 10 ++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/public/src/admin/manage/category.js b/public/src/admin/manage/category.js index 4a0fbf3f6e..ac4b6a50cc 100644 --- a/public/src/admin/manage/category.js +++ b/public/src/admin/manage/category.js @@ -283,10 +283,9 @@ define('admin/manage/category', [ }); modal.on('shown.bs.modal', function() { - var inputEl = modal.find('input'), - searchObj = autocomplete.user(inputEl); + var inputEl = modal.find('input'); - searchObj.on('autocompleteselect', function(ev, ui) { + autocomplete.user(inputEl, function(ev, ui) { socket.emit('admin.categories.setPrivilege', { cid: ajaxify.variables.get('cid'), privilege: ['find', 'read'], @@ -312,10 +311,9 @@ define('admin/manage/category', [ }); modal.on('shown.bs.modal', function() { - var inputEl = modal.find('input'), - searchObj = autocomplete.group(inputEl); + var inputEl = modal.find('input'); - searchObj.on('autocompleteselect', function(ev, ui) { + autocomplete.group(inputEl, function(ev, ui) { socket.emit('admin.categories.setPrivilege', { cid: ajaxify.variables.get('cid'), privilege: ['groups:find', 'groups:read'], diff --git a/public/src/modules/autocomplete.js b/public/src/modules/autocomplete.js index aa4f6a7e51..0f4ca57c2e 100644 --- a/public/src/modules/autocomplete.js +++ b/public/src/modules/autocomplete.js @@ -6,10 +6,11 @@ define('autocomplete', function() { var module = {}; - module.user = function (input) { + module.user = function (input, onselect) { app.loadJQueryUI(function() { - return input.autocomplete({ + input.autocomplete({ delay: 100, + select: onselect, source: function(request, response) { socket.emit('user.search', {query: request.term}, function(err, result) { if (err) { @@ -37,10 +38,11 @@ define('autocomplete', function() { }); }; - module.group = function(input) { + module.group = function(input, onselect) { app.loadJQueryUI(function() { - return input.autocomplete({ + input.autocomplete({ delay: 100, + select: onselect, source: function(request, response) { socket.emit('groups.search', { query: request.term,