mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Edit country select in forms
This commit is contained in:
parent
7537bb3712
commit
195aa4a890
7 changed files with 147 additions and 104 deletions
|
@ -57,7 +57,7 @@ class Admin::RegistrarsController < AdminController
|
|||
def registrar_params
|
||||
params.require(:registrar).permit(
|
||||
:name, :reg_no, :vat_no, :address, :billing_address,
|
||||
:country_id, :email, :phone, :billing_email
|
||||
:country_code, :email, :phone, :billing_email
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,6 +54,6 @@ class Admin::UsersController < AdminController
|
|||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:username, :password, :identity_code, :email, :country_id, { roles: [] })
|
||||
params.require(:user).permit(:username, :password, :identity_code, :email, :country_code, { roles: [] })
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class Address < ActiveRecord::Base
|
|||
def addr_hash_from_params(addr)
|
||||
return {} if addr.nil?
|
||||
return {} unless addr[:addr].is_a?(Hash)
|
||||
{ country_id: Country.find_by(iso: addr[:addr][:cc]).try(:id),
|
||||
{ country_code: Country.find_by(iso: addr[:addr][:cc]).try(:id),
|
||||
city: addr[:addr][:city],
|
||||
street: pretty_street(addr[:addr][:street]), # [0],
|
||||
# street2: addr[:addr][:street][1],
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
.col-md-6.text-left
|
||||
.form-group
|
||||
= f.label :country_id
|
||||
= f.select :country_id, options_for_select(Country.all.map{|x| [x.name, x.id]}, @registrar.country_id), {}, {class: 'form-control selectize'}
|
||||
= f.label :country_code
|
||||
= f.text_field :country_code, class: 'form-control'
|
||||
.form-group
|
||||
= f.label :address
|
||||
= f.text_field(:address, class: 'form-control')
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
= f.label :password
|
||||
= f.text_field(:password, class: 'form-control')
|
||||
.form-group
|
||||
= f.label :country_id
|
||||
= f.collection_select :country_id, Country.all, :id, :name, {}, { class: 'form-control selectize' }
|
||||
= f.label :country_code
|
||||
= f.text_field :country_code, class: 'form-control'
|
||||
.form-group
|
||||
= f.label :identity_code
|
||||
= f.text_field(:identity_code, class: 'form-control')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue