mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Preselect default values for new record #2776
This commit is contained in:
parent
dec7fcee13
commit
cc672a420b
3 changed files with 7 additions and 11 deletions
|
@ -144,13 +144,6 @@ module Depp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(attributes = {})
|
|
||||||
super
|
|
||||||
self.country_code = 'EE' if country_code.blank?
|
|
||||||
self.ident_type = 'bic' if ident_type.blank?
|
|
||||||
self.ident_country_code = 'EE' if ident_country_code.blank?
|
|
||||||
end
|
|
||||||
|
|
||||||
def save
|
def save
|
||||||
create_xml = Depp::Contact.epp_xml.create(
|
create_xml = Depp::Contact.epp_xml.create(
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,5 +30,6 @@
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :country_code, t(:country) + '*'
|
= f.label :country_code, t(:country) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.select :country_code,
|
- country_selected = f.object.persisted? ? f.object.country_code : 'EE'
|
||||||
SortedCountry.all_options(f.object.country_code)
|
= f.select :country_code, SortedCountry.all_options(country_selected),
|
||||||
|
{ include_blank: true }
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
= Country.new(f.object.ident_country_code).try(:to_s)
|
= Country.new(f.object.ident_country_code).try(:to_s)
|
||||||
= " [#{f.object.ident_country_code}]"
|
= " [#{f.object.ident_country_code}]"
|
||||||
- else
|
- else
|
||||||
= f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {},
|
- country_selected = @contact.persisted? ? '' : 'EE'
|
||||||
|
= f.select(:ident_country_code, SortedCountry.all_options(country_selected), {},
|
||||||
class: 'js-ident-country-code', required: true)
|
class: 'js-ident-country-code', required: true)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
|
@ -23,8 +24,9 @@
|
||||||
= Depp::Contact.type_string(f.object.ident_type)
|
= Depp::Contact.type_string(f.object.ident_type)
|
||||||
= " [#{f.object.ident_type}]"
|
= " [#{f.object.ident_type}]"
|
||||||
- else
|
- else
|
||||||
|
- type_selected = @contact.persisted? ? '' : 'bic'
|
||||||
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
||||||
{ selected: f.object.ident_type },
|
{ selected: type_selected },
|
||||||
class: 'js-ident-type', required: true)
|
class: 'js-ident-type', required: true)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue