mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Added registrar code
This commit is contained in:
parent
85efa5eb28
commit
8b22c58eec
7 changed files with 28 additions and 5 deletions
|
@ -57,7 +57,7 @@ class Admin::RegistrarsController < AdminController
|
|||
def registrar_params
|
||||
params.require(:registrar).permit(
|
||||
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
||||
:country_code, :email, :phone, :billing_email
|
||||
:country_code, :email, :phone, :billing_email, :code
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Registrar < ActiveRecord::Base
|
|||
|
||||
belongs_to :country_deprecated, foreign_key: :country_id
|
||||
|
||||
validates :name, :reg_no, :country_code, :email, presence: true
|
||||
validates :name, :reg_no, :country_code, :email, :code, presence: true
|
||||
validates :name, :reg_no, :reference_no, uniqueness: true
|
||||
validate :set_code, if: :new_record?
|
||||
|
||||
|
@ -139,7 +139,11 @@ class Registrar < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def code=(code)
|
||||
self[:code] = code if new_record?
|
||||
self[:code] = code.upcase if new_record? && code.present?
|
||||
end
|
||||
|
||||
def contact_prefix
|
||||
"CID:#{code}:"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -70,6 +70,19 @@
|
|||
.col-md-7
|
||||
= f.select(:country_code,
|
||||
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
.panel.panel-default
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t(:misc)
|
||||
.panel-body
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :code
|
||||
.col-md-7
|
||||
= f.text_field(:code, class: 'form-control')
|
||||
|
||||
%hr
|
||||
.row
|
||||
.col-md-8.text-right
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
%dt= t(:reference_no)
|
||||
%dd= @registrar.reference_no
|
||||
|
||||
%dt= t(:code)
|
||||
%dd= @registrar.code
|
||||
|
||||
.col-md-6
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue