mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Show ident info as text #2776
This commit is contained in:
parent
4ade318870
commit
0e4f333c47
2 changed files with 25 additions and 10 deletions
|
@ -136,6 +136,12 @@ module Depp
|
||||||
end
|
end
|
||||||
hash
|
hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def type_string(type_code)
|
||||||
|
return '' if type_code.blank?
|
||||||
|
t = SELECTION_TYPES.select { |tp| tp.second == type_code }
|
||||||
|
t.try(:first)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(attributes = {})
|
def initialize(attributes = {})
|
||||||
|
|
|
@ -6,26 +6,35 @@
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :ident_country_code, t(:country) + '*'
|
= f.label :ident_country_code, t(:country) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code),
|
- if f.object.ident_country_code.present?
|
||||||
{ selected: f.object.ident_country_code, include_blank: true },
|
= Country.new(f.object.ident_country_code).try(:to_s)
|
||||||
class: 'js-ident-country-code', required: true, disabled: @contact.persisted?)
|
- else
|
||||||
|
= f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {},
|
||||||
|
class: 'js-ident-country-code', required: true)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :ident_type, t(:type) + '*'
|
= f.label :ident_type, t(:type) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
- if f.object.ident_type.present?
|
||||||
{ selected: f.object.ident_type, include_blank: true },
|
= Depp::Contact.type_string(f.object.ident_type)
|
||||||
class: 'js-ident-type', required: true, disabled: @contact.persisted?)
|
= " [#{f.object.ident_type}]"
|
||||||
|
- else
|
||||||
|
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
||||||
|
{ selected: f.object.ident_type },
|
||||||
|
class: 'js-ident-type', required: true)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :ident, t(:ident) + '*'
|
= f.label :ident, t(:ident) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field :ident, class: 'form-control', required: true, disabled: @contact.persisted?
|
- if f.object.ident.present?
|
||||||
- tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none'
|
= f.object.ident
|
||||||
.js-ident-tip{ style: tip_visibility }
|
- else
|
||||||
= t(:birthday_format)
|
= f.text_field :ident, class: 'form-control', required: true, disabled: @contact.persisted?
|
||||||
|
- tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none'
|
||||||
|
.js-ident-tip{ style: tip_visibility }
|
||||||
|
= t(:birthday_format)
|
||||||
|
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue