Fixed search result, used _.debounce in correct way.
This commit is contained in:
parent
0e5e8d0573
commit
62d35d2a0e
3 changed files with 7 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
# coffeelint: disable=camel_case_classes
|
# coffeelint: disable=camel_case_classes
|
||||||
class App.UiElement.user_autocompletion
|
class App.UiElement.user_autocompletion
|
||||||
@render: (attribute) ->
|
@render: (attribute, params = {}) ->
|
||||||
new App.UserOrganizationAutocompletion(attribute: attribute).element()
|
new App.UserOrganizationAutocompletion(attribute: attribute, params: params).element()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# coffeelint: disable=camel_case_classes
|
# coffeelint: disable=camel_case_classes
|
||||||
class App.UiElement.user_autocompletion_search
|
class App.UiElement.user_autocompletion_search
|
||||||
@render: (attributeOrig) ->
|
@render: (attributeOrig, params = {}) ->
|
||||||
attribute = _.clone(attributeOrig)
|
attribute = _.clone(attributeOrig)
|
||||||
attribute.disableCreateUser = true
|
attribute.disableCreateUser = true
|
||||||
new App.UserOrganizationAutocompletion(attribute: attribute).element()
|
new App.UserOrganizationAutocompletion(attribute: attribute, params: params).element()
|
||||||
|
|
|
@ -23,7 +23,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
|
||||||
constructor: (params) ->
|
constructor: (params) ->
|
||||||
super
|
super
|
||||||
|
|
||||||
@lazySearch = _.debounce(@searchUser, 200, true)
|
@lazySearch = _.debounce(@searchUser, 200)
|
||||||
|
|
||||||
@key = Math.floor( Math.random() * 999999 ).toString()
|
@key = Math.floor( Math.random() * 999999 ).toString()
|
||||||
|
|
||||||
|
@ -260,6 +260,8 @@ class App.UserOrganizationAutocompletion extends App.Controller
|
||||||
name = user.displayName()
|
name = user.displayName()
|
||||||
if user.email
|
if user.email
|
||||||
name += " <#{user.email}>"
|
name += " <#{user.email}>"
|
||||||
|
else if @params && @params["#{@attribute.name}_completion"]
|
||||||
|
name = @params["#{@attribute.name}_completion"]
|
||||||
else
|
else
|
||||||
@log 'userId doesn\'t exist', value
|
@log 'userId doesn\'t exist', value
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue