Fixed search result, used _.debounce in correct way.

This commit is contained in:
Martin Edenhofer 2016-04-25 23:06:39 +02:00
parent 0e5e8d0573
commit 62d35d2a0e
3 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.user_autocompletion
@render: (attribute) ->
new App.UserOrganizationAutocompletion(attribute: attribute).element()
@render: (attribute, params = {}) ->
new App.UserOrganizationAutocompletion(attribute: attribute, params: params).element()

View file

@ -1,6 +1,6 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.user_autocompletion_search
@render: (attributeOrig) ->
@render: (attributeOrig, params = {}) ->
attribute = _.clone(attributeOrig)
attribute.disableCreateUser = true
new App.UserOrganizationAutocompletion(attribute: attribute).element()
new App.UserOrganizationAutocompletion(attribute: attribute, params: params).element()

View file

@ -23,7 +23,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
constructor: (params) ->
super
@lazySearch = _.debounce(@searchUser, 200, true)
@lazySearch = _.debounce(@searchUser, 200)
@key = Math.floor( Math.random() * 999999 ).toString()
@ -260,6 +260,8 @@ class App.UserOrganizationAutocompletion extends App.Controller
name = user.displayName()
if user.email
name += " <#{user.email}>"
else if @params && @params["#{@attribute.name}_completion"]
name = @params["#{@attribute.name}_completion"]
else
@log 'userId doesn\'t exist', value