Registrar: domain form autocompletes registrar and contact code

This commit is contained in:
Priit Tark 2015-05-07 15:50:55 +03:00
parent 2b9923de49
commit 2ea24f42fc
8 changed files with 29 additions and 4 deletions

View file

@ -17,11 +17,15 @@
.col-md-3.control-label
= label_tag "domain_contacts_attributes_#{k}_code", t(:contact_code), class: 'required'
.col-md-7.has-feedback
= text_field_tag("domain[contacts_attributes][#{k}][code]", v['code'],
class: 'form-control', placeholder: t(:contact_code), autocomplete: 'off', required: true)
= select_tag "domain[contacts_attributes][#{k}][code]",
options_for_select(@contacts_autocomplete_map, selected: v['code']),
include_blank: true, class: 'js-combobox', required: true
:coffee
$("#domain-contacts").nestedAttributes
bindAddTo: $(".add-domain-contact")
afterAdd: (item) ->
item.find('select').each (k, v) ->
$(v).val($(v).find('option:first-child').val())

View file

@ -20,5 +20,6 @@
.col-md-3.control-label
= label_tag :domain_registrant, t(:registrant), class: 'required'
.col-md-7
= text_field_tag('domain[registrant]', @domain_params[:registrant],
class: 'form-control', placeholder: t(:contact_code), autocomplete: 'off', required: true)
= select_tag "domain[registrant]",
options_for_select(@contacts_autocomplete_map, selected: @domain_params[:registrant]),
include_blank: true, class: 'js-combobox', required: true