mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Bind typehead to contact too
This commit is contained in:
parent
13349a6bc9
commit
1c165cd1e4
7 changed files with 55 additions and 30 deletions
|
@ -1,20 +1,9 @@
|
|||
registrarSource = new Bloodhound(
|
||||
datumTokenizer: (d) ->
|
||||
Bloodhound.tokenizers.whitespace d.display_key
|
||||
Autocomplete.bindTypeahead
|
||||
remote: '/admin/registrars/search'
|
||||
selector: '.js-registrar-typeahead'
|
||||
hiddenSelector: '.js-registrar-id'
|
||||
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace
|
||||
remote: "/admin/registrars/search?q=%QUERY"
|
||||
)
|
||||
|
||||
registrarSource.initialize()
|
||||
$(".js-registrars-typeahead").typeahead(
|
||||
highlight: true,
|
||||
hint: false
|
||||
,
|
||||
displayKey: "display_key"
|
||||
source: registrarSource.ttAdapter()
|
||||
).on('typeahead:selected', (e, obj) ->
|
||||
$('input[name="domain[registrar_id]"]').val obj.id
|
||||
$('.js-registrar-selected').removeClass('hidden')
|
||||
$('.js-registrar-unselected').addClass('hidden')
|
||||
)
|
||||
Autocomplete.bindTypeahead
|
||||
remote: '/admin/contacts/search'
|
||||
selector: '.js-contact-typeahead'
|
||||
hiddenSelector: '.js-contact-id'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue