mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +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
|
||||
|
||||
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
|
||||
create_xml = Depp::Contact.epp_xml.create(
|
||||
{
|
||||
|
|
|
@ -30,5 +30,6 @@
|
|||
.col-md-3.control-label
|
||||
= f.label :country_code, t(:country) + '*'
|
||||
.col-md-7
|
||||
= f.select :country_code,
|
||||
SortedCountry.all_options(f.object.country_code)
|
||||
- country_selected = f.object.persisted? ? f.object.country_code : 'EE'
|
||||
= 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)
|
||||
= " [#{f.object.ident_country_code}]"
|
||||
- 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)
|
||||
|
||||
.form-group
|
||||
|
@ -23,8 +24,9 @@
|
|||
= Depp::Contact.type_string(f.object.ident_type)
|
||||
= " [#{f.object.ident_type}]"
|
||||
- else
|
||||
- type_selected = @contact.persisted? ? '' : 'bic'
|
||||
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
||||
{ selected: f.object.ident_type },
|
||||
{ selected: type_selected },
|
||||
class: 'js-ident-type', required: true)
|
||||
|
||||
.form-group
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue