mirror of
https://github.com/internetee/registry.git
synced 2025-05-30 01:20:04 +02:00
Relax email inputs on client side #2855
This commit is contained in:
parent
d5563a4d2b
commit
af6f3bc87e
4 changed files with 11 additions and 8 deletions
|
@ -18,3 +18,6 @@ $.validator.setDefaults
|
||||||
error.insertAfter element
|
error.insertAfter element
|
||||||
return
|
return
|
||||||
|
|
||||||
|
jQuery.validator.addMethod 'lax_email', ((value, element) ->
|
||||||
|
@optional(element) or (value.match(new RegExp("@", "g")) || []).length == 1
|
||||||
|
), 'Please enter a valid email address.'
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
.col-md-4.control-label
|
.col-md-4.control-label
|
||||||
= f.label :email
|
= f.label :email
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= f.text_field(:email, class: 'form-control', email: true)
|
= f.text_field(:email, class: 'form-control', lax_email: true)
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-4.control-label
|
.col-md-4.control-label
|
||||||
= f.label :country_code, t(:country)
|
= f.label :country_code, t(:country)
|
||||||
|
|
|
@ -31,12 +31,12 @@
|
||||||
.col-md-4.control-label
|
.col-md-4.control-label
|
||||||
= f.label :email
|
= f.label :email
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field(:email, class: 'form-control', email: true)
|
= f.text_field(:email, class: 'form-control', lax_email: true)
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-4.control-label
|
.col-md-4.control-label
|
||||||
= f.label :billing_email
|
= f.label :billing_email
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field(:billing_email, class: 'form-control', email: true)
|
= f.text_field(:billing_email, class: 'form-control', lax_email: true)
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
.col-md-4.control-label
|
.col-md-4.control-label
|
||||||
= f.label :country_code, t(:country)
|
= f.label :country_code, t(:country)
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.select(:country_code,
|
= f.select(:country_code,
|
||||||
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
|
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
|
||||||
|
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
= " [#{f.object.ident_country_code}]"
|
= " [#{f.object.ident_country_code}]"
|
||||||
- else
|
- else
|
||||||
- country_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_country_code) || 'EE')
|
- country_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_country_code) || 'EE')
|
||||||
= f.select(:ident_country_code, SortedCountry.all_options(country_selected), {},
|
= 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
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
= " [#{f.object.ident_type}]"
|
= " [#{f.object.ident_type}]"
|
||||||
- else
|
- else
|
||||||
- type_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_type) || 'bic')
|
- type_selected = @contact.persisted? ? '' : (params[:depp_contact].try(:[], :ident_type) || 'bic')
|
||||||
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES,
|
||||||
{ selected: type_selected },
|
{ selected: type_selected },
|
||||||
class: 'js-ident-type', required: true)
|
class: 'js-ident-type', required: true)
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :email, t(:email) + '*'
|
= f.label :email, t(:email) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field :email, class: 'form-control', required: true, email: true
|
= f.text_field :email, class: 'form-control', required: true, lax_email: true
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
.col-md-3.control-label
|
.col-md-3.control-label
|
||||||
= f.label :phone, t(:phone) + '*'
|
= f.label :phone, t(:phone) + '*'
|
||||||
.col-md-7
|
.col-md-7
|
||||||
= f.text_field :phone, class: 'form-control',
|
= f.text_field :phone, class: 'form-control',
|
||||||
placeholder: '+372.12323344', required: true
|
placeholder: '+372.12323344', required: true
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue