make contacts searchable

This commit is contained in:
Vladimir Krylov 2015-10-22 09:49:36 +03:00
parent b088d39b0e
commit 3d2c9c01a6
7 changed files with 56 additions and 12 deletions

View file

@ -18,9 +18,8 @@
.col-md-3.control-label
= label_tag "domain_contacts_attributes_#{k}_code", t(:id), class: 'required'
.col-md-7.has-feedback
= select_tag "domain[contacts_attributes][#{k}][code]",
options_for_select(@contacts_autocomplete_map, selected: v['code']),
include_blank: true, class: 'js-combobox js-contact-code', required: true
= text_field_tag "domain[contacts_attributes][#{k}][code]", v['code'], class: "hidden"
= text_field_tag "domain[contacts_attributes][#{k}][code_helper]", contacts.find_by(code: v['code']).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true
:coffee
clone = $('.js-contact:first').clone()
@ -39,4 +38,5 @@
# remove link for temp
item.find('a.add-domain-contact').each (k, v) ->
$(v).hide()
new Autocomplete()
$clone: clone

View file

@ -20,9 +20,9 @@
.col-md-3.control-label
= label_tag :domain_registrant, t(:registrant), class: 'required'
.col-md-7
= select_tag "domain[registrant]",
options_for_select(@contacts_autocomplete_map, selected: @domain_params[:registrant]),
include_blank: true, class: 'js-combobox', required: true
= text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden"
= text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name),
class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true
- unless params[:domain_name]
.form-group