Merge pull request #395 from internetee/registry-279

Registry 279
This commit is contained in:
Timo Võhmar 2017-03-01 14:55:19 +02:00 committed by GitHub
commit 924df78fe5
31 changed files with 212 additions and 34 deletions

View file

@ -23,10 +23,10 @@ class Admin::RegistrarsController < AdminController
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
end
flash[:notice] = I18n.t('registrar_added')
flash[:notice] = t('.created')
redirect_to [:admin, @registrar]
rescue ActiveRecord::RecordInvalid
flash.now[:alert] = I18n.t('failed_to_add_registrar')
flash.now[:alert] = t('.not_created')
render 'new'
end
end
@ -35,10 +35,10 @@ class Admin::RegistrarsController < AdminController
def update
if @registrar.update(registrar_params)
flash[:notice] = I18n.t('registrar_updated')
flash[:notice] = t('.updated')
redirect_to [:admin, @registrar]
else
flash.now[:alert] = I18n.t('failed_to_update_registrar')
flash.now[:alert] = t('.not_updated')
render 'edit'
end
end
@ -62,7 +62,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, :code, :test_registrar
:country_code, :email, :phone, :website, :billing_email, :code, :test_registrar
)
end
end

View file

@ -12,7 +12,7 @@ class Registrar < ActiveRecord::Base
has_many :priv_contacts, -> { privs }, class_name: 'Contact'
has_many :white_ips, dependent: :destroy
delegate :balance, to: :cash_account
delegate :balance, to: :cash_account, allow_nil: true
validates :name, :reg_no, :country_code, :email, :code, presence: true
validates :name, :reg_no, :reference_no, :code, uniqueness: true
@ -102,7 +102,7 @@ class Registrar < ActiveRecord::Base
buyer_city: city,
buyer_zip: zip,
buyer_phone: phone,
buyer_url: url,
buyer_url: website,
buyer_email: email,
reference_no: reference_no,
invoice_items_attributes: [

View file

@ -85,7 +85,7 @@ class WhoisRecord < ActiveRecord::Base
# update registar triggers when adding new attributes
h[:registrar] = domain.registrar.name
h[:registrar_url] = domain.registrar.url
h[:registrar_website] = domain.registrar.website
h[:registrar_phone] = domain.registrar.phone
h[:registrar_address] = domain.registrar.address
h[:registrar_changed] = domain.registrar.updated_at.try(:to_s, :iso8601)

View file

@ -16,8 +16,8 @@ class RegistrarPresenter
registrar.phone
end
def url
registrar.url
def website
registrar.website
end
private

View file

@ -27,6 +27,11 @@
= f.label :phone
.col-md-7
= f.text_field(:phone, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :website
.col-md-7
= f.url_field :website, class: 'form-control'
.form-group
.col-md-4.control-label
= f.label :email
@ -75,7 +80,7 @@
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:misc)
.pull-left= t('.misc')
.panel-body
.form-group
.col-md-4.control-label
@ -91,4 +96,4 @@
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success')

View file

@ -1,5 +1,5 @@
- content_for :actions do
= link_to(t(:new), new_admin_registrar_path, class: 'btn btn-primary')
= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:registrars)
.row

View file

@ -39,6 +39,9 @@
%dt= t(:credit_balance)
%dd= @registrar.balance
%dt= Registrar.human_attribute_name :website
%dd= @registrar.website
.col-md-6
.panel.panel-default
.panel-heading

View file

@ -40,7 +40,7 @@ changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %>
<%- end -%>
Registrar:
name: <%= json['registrar'] %>
url: <%= json['registrar_url'] %>
url: <%= json['registrar_website'] %>
phone: <%= json['registrar_phone'] %>
changed: <%= json['registrar_changed'].to_s.tr('T',' ').sub('+', ' +') %>

View file

@ -2,5 +2,5 @@
<%= registrar.name %><br>
Email: <%= registrar.email %><br>
Phone: <%= registrar.phone %><br>
Website: <%= registrar.url %>
Website: <%= registrar.website %>
</p>

View file

@ -1,4 +1,4 @@
<%= registrar.name %>
Email: <%= registrar.email %>
Phone: <%= registrar.phone %>
Website: <%= registrar.url %>
Website: <%= registrar.website %>

View file

@ -2,5 +2,5 @@
<%= registrar.name %><br>
Email: <%= registrar.email %><br>
Telefon: <%= registrar.phone %><br>
Veebileht: <%= registrar.url %>
Veebileht: <%= registrar.website %>
</p>

View file

@ -1,4 +1,4 @@
<%= registrar.name %>
Email: <%= registrar.email %>
Telefon: <%= registrar.phone %>
Veebileht: <%= registrar.url %>
Veebileht: <%= registrar.website %>

View file

@ -2,5 +2,5 @@
<%= registrar.name %><br>
Электронная почта: <%= registrar.email %><br>
Телефон: <%= registrar.phone %><br>
Веб-сайт: <%= registrar.url %>
Веб-сайт: <%= registrar.website %>
</p>

View file

@ -1,4 +1,4 @@
<%= registrar.name %>
Электронная почта: <%= registrar.email %>
Телефон: <%= registrar.phone %>
Веб-сайт: <%= registrar.url %>
Веб-сайт: <%= registrar.website %>