mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
Add some new contact fields to registrar
This commit is contained in:
parent
0c16146ebb
commit
65d849cc36
10 changed files with 81 additions and 24 deletions
|
@ -55,6 +55,9 @@ class Admin::RegistrarsController < AdminController
|
|||
end
|
||||
|
||||
def registrar_params
|
||||
params.require(:registrar).permit(:name, :reg_no, :vat_no, :address, :billing_address, :country_id)
|
||||
params.require(:registrar).permit(
|
||||
:name, :reg_no, :vat_no, :address, :billing_address,
|
||||
:country_id, :email, :phone, :billing_email
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,6 @@ class Epp::DomainsController < EppController
|
|||
end
|
||||
|
||||
def renew
|
||||
# TODO: support period unit
|
||||
@domain = find_domain
|
||||
|
||||
handle_errors(@domain) and return unless @domain
|
||||
|
|
|
@ -5,9 +5,11 @@ class Registrar < ActiveRecord::Base
|
|||
has_many :api_users, dependent: :restrict_with_error
|
||||
has_many :messages
|
||||
|
||||
validates :name, :reg_no, :address, :country, presence: true
|
||||
validates :name, :reg_no, :address, :country, :email, presence: true
|
||||
validates :name, :reg_no, uniqueness: true
|
||||
|
||||
validates :email, :billing_email, format: /@/, allow_blank: true
|
||||
|
||||
def domain_transfers
|
||||
at = DomainTransfer.arel_table
|
||||
DomainTransfer.where(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
= form_for([:admin, @registrar]) do |f|
|
||||
- if @registrar.errors.any?
|
||||
- @registrar.errors.each do |attr, err|
|
||||
- @registrar.errors.full_messages.each do |err|
|
||||
= err
|
||||
%br
|
||||
- if @registrar.errors.any?
|
||||
|
@ -14,9 +14,16 @@
|
|||
.form-group
|
||||
= f.label :reg_no
|
||||
= f.text_field(:reg_no, class: 'form-control')
|
||||
/ EIS does not want VAT
|
||||
/ .form-group
|
||||
/ = f.label :vat_no
|
||||
/ = f.text_field(:vat_no, class: 'form-control')
|
||||
.form-group
|
||||
= f.label :vat_no
|
||||
= f.text_field(:vat_no, class: 'form-control')
|
||||
= f.label :email
|
||||
= f.text_field(:email, class: 'form-control')
|
||||
.form-group
|
||||
= f.label :phone
|
||||
= f.text_field(:phone, class: 'form-control')
|
||||
|
||||
.col-md-6.text-left
|
||||
.form-group
|
||||
|
@ -25,9 +32,14 @@
|
|||
.form-group
|
||||
= f.label :address
|
||||
= f.text_field(:address, class: 'form-control')
|
||||
%p.help-block= t('address_help')
|
||||
.form-group
|
||||
= f.label :billing_address
|
||||
= f.text_field(:billing_address, class: 'form-control')
|
||||
%p.help-block= t('address_help')
|
||||
.form-group
|
||||
= f.label :billing_email
|
||||
= f.text_field(:billing_email, class: 'form-control')
|
||||
%hr
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
.col-md-6
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h3.panel-title= t('address')
|
||||
%h3.panel-title= t('contact')
|
||||
.panel-body
|
||||
%dl.dl-horizontal
|
||||
%dt= t('country')
|
||||
|
@ -42,9 +42,18 @@
|
|||
%dt= t('address')
|
||||
%dd= @registrar.address
|
||||
|
||||
%dt= t('contact_phone')
|
||||
%dd= @registrar.phone
|
||||
|
||||
%dt= t('contact_email')
|
||||
%dd= @registrar.email
|
||||
|
||||
%dt= t('billing_address')
|
||||
%dd= @registrar.billing_address
|
||||
|
||||
%dt= t('billing_email')
|
||||
%dd= @registrar.billing_email
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
#epp-users.panel.panel-default
|
||||
|
|
|
@ -151,22 +151,6 @@ en:
|
|||
setting_id:
|
||||
taken: 'Status already exists on this domain'
|
||||
|
||||
|
||||
registrar:
|
||||
attributes:
|
||||
name:
|
||||
blank: 'Name is missing'
|
||||
taken: 'Name already exists'
|
||||
reg_no:
|
||||
blank: 'Reg. number is missing'
|
||||
taken: 'Reg no. already exists'
|
||||
vat_no:
|
||||
blank: 'Vat number is missing'
|
||||
country:
|
||||
blank: 'Country is missing'
|
||||
address:
|
||||
blank: 'Address is missing'
|
||||
|
||||
user:
|
||||
attributes:
|
||||
username:
|
||||
|
@ -248,6 +232,10 @@ en:
|
|||
expire: 'Expire'
|
||||
minimum_ttl: 'Minimum TTL'
|
||||
email: 'E-Mail'
|
||||
registrar:
|
||||
billing_email: 'Billing e-mail'
|
||||
phone: 'Contact phone'
|
||||
email: 'Contact e-mail'
|
||||
|
||||
errors:
|
||||
messages:
|
||||
|
@ -505,3 +493,8 @@ en:
|
|||
clear_fields: 'Clear fields'
|
||||
created_before: 'Created before'
|
||||
created_after: 'Created after'
|
||||
billing_address: 'Billing address'
|
||||
billing_email: 'Billing e-mail'
|
||||
contact_phone: 'Contact phone'
|
||||
contact_email: 'Contact e-mail'
|
||||
address_help: 'Street name, house no - apartment no, city, county, country, zip'
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class AddMoreFieldsToRegistrar < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :registrars, :phone, :string
|
||||
add_column :registrars, :email, :string
|
||||
add_column :registrars, :billing_email, :string
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150129114042) do
|
||||
ActiveRecord::Schema.define(version: 20150130085458) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -293,6 +293,9 @@ ActiveRecord::Schema.define(version: 20150129114042) do
|
|||
t.string "billing_address", limit: 255
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "phone"
|
||||
t.string "email"
|
||||
t.string "billing_email"
|
||||
end
|
||||
|
||||
create_table "reserved_domains", force: :cascade do |t|
|
||||
|
|
|
@ -4,6 +4,7 @@ describe Keyrelay do
|
|||
it { should belong_to(:domain) }
|
||||
it { should belong_to(:requester) }
|
||||
it { should belong_to(:accepter) }
|
||||
it { should have_many(:legal_documents) }
|
||||
|
||||
it 'is in pending status' do
|
||||
kr = Fabricate(:keyrelay)
|
||||
|
|
|
@ -5,4 +5,32 @@ describe Registrar do
|
|||
it { should have_many(:domains) }
|
||||
it { should have_many(:api_users) }
|
||||
it { should have_many(:messages) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@registrar = Registrar.new
|
||||
end
|
||||
|
||||
it 'is not valid' do
|
||||
@registrar.valid?
|
||||
@registrar.errors.full_messages.should match_array([
|
||||
'Address is missing',
|
||||
'Contact e-mail is missing',
|
||||
'Country is missing',
|
||||
'Name is missing',
|
||||
'Reg no is missing'
|
||||
])
|
||||
end
|
||||
|
||||
it 'returns an error with invalid email' do
|
||||
@registrar.email = 'bla'
|
||||
@registrar.billing_email = 'bla'
|
||||
|
||||
@registrar.valid?
|
||||
@registrar.errors[:email].should == ['is invalid']
|
||||
@registrar.errors[:billing_email].should == ['is invalid']
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue