Add some new contact fields to registrar

This commit is contained in:
Martin Lensment 2015-01-30 11:53:33 +02:00
parent 0c16146ebb
commit 65d849cc36
10 changed files with 81 additions and 24 deletions

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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

View file

@ -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