mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
commit
49c6a97146
9 changed files with 35 additions and 18 deletions
|
@ -1,12 +1,9 @@
|
|||
#= require jquery
|
||||
#= require jquery_ujs
|
||||
#= require jquery.validate
|
||||
#= require jquery.validate.additional-methods
|
||||
#= require turbolinks
|
||||
#= require bootstrap-sprockets
|
||||
#= require typeahead.bundle.min
|
||||
#= require jquery.nested_attributes
|
||||
#= require shared/jquery.validate.bootstrap
|
||||
#= require jquery-ui/datepicker
|
||||
#= require select2
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
$(document).on 'page:change', ->
|
||||
# client side validate all forms
|
||||
$('form').each ->
|
||||
$(this).validate()
|
||||
|
||||
$('.js-contact-form').on 'restoreDefault', (e) ->
|
||||
form = $(e.target)
|
||||
form.find('.js-ident-tip').hide()
|
||||
|
|
|
@ -17,7 +17,3 @@ $.validator.setDefaults
|
|||
else
|
||||
error.insertAfter element
|
||||
return
|
||||
|
||||
jQuery.validator.addMethod 'lax_email', ((value, element) ->
|
||||
@optional(element) or (value.match(new RegExp("@", "g")) || []).length == 1
|
||||
), 'Please enter a valid email address.'
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
.col-md-4.control-label
|
||||
= f.label :email
|
||||
.col-md-8
|
||||
= f.text_field(:email, class: 'form-control', lax_email: true)
|
||||
= f.email_field :email, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :country_code, t(:country)
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
.col-md-4.control-label
|
||||
= f.label :from
|
||||
.col-md-7
|
||||
= f.text_field(:from, class: 'form-control', lax_email: true)
|
||||
= f.email_field :from, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :cc
|
||||
.col-md-7
|
||||
= f.text_field(:cc, class: 'form-control', lax_email: true)
|
||||
= f.email_field :cc, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :bcc
|
||||
.col-md-7
|
||||
= f.text_field(:bcc, class: 'form-control', lax_email: true)
|
||||
= f.email_field :bcc, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-12
|
||||
= f.label :body, t(:html_body)
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
.col-md-4.control-label
|
||||
= f.label :email
|
||||
.col-md-7
|
||||
= f.text_field(:email, class: 'form-control', lax_email: true)
|
||||
= f.email_field :email, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :billing_email
|
||||
.col-md-7
|
||||
= f.text_field(:billing_email, class: 'form-control', lax_email: true)
|
||||
= f.email_field :billing_email, class: 'form-control'
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
.col-md-3.control-label
|
||||
= f.label :email, t(:email) + '*'
|
||||
.col-md-7
|
||||
= f.text_field :email, class: 'form-control', required: true, lax_email: true
|
||||
= f.email_field :email, class: 'form-control', required: true
|
||||
|
||||
.form-group
|
||||
.col-md-3.control-label
|
||||
|
|
|
@ -17,6 +17,16 @@ RSpec.describe 'admin registrar create' do
|
|||
expect(registrar.website).to eq('test')
|
||||
end
|
||||
|
||||
it 'saves email' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar, email: 'test@test.com') }
|
||||
expect(registrar.email).to eq('test@test.com')
|
||||
end
|
||||
|
||||
it 'saves billing email' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar, billing_email: 'test@test.com') }
|
||||
expect(registrar.billing_email).to eq('test@test.com')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar) }
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
|
|
|
@ -14,6 +14,24 @@ RSpec.describe 'admin registrar update' do
|
|||
expect(registrar.website).to eq('new-website')
|
||||
end
|
||||
|
||||
it 'updates email' do
|
||||
registrar = create(:registrar, email: 'test@test.com')
|
||||
|
||||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, email: 'new-test@test.com')
|
||||
registrar.reload
|
||||
|
||||
expect(registrar.email).to eq('new-test@test.com')
|
||||
end
|
||||
|
||||
it 'updates billing email' do
|
||||
registrar = create(:registrar, billing_email: 'test@test.com')
|
||||
|
||||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, billing_email: 'new-test@test.com')
|
||||
registrar.reload
|
||||
|
||||
expect(registrar.billing_email).to eq('new-test@test.com')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
registrar = create(:registrar)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue