Merge branch 'master' of github.com:domify/registry

Conflicts:
	db/schema.rb
This commit is contained in:
Martin Lensment 2015-04-14 19:01:17 +03:00
commit 2dfa65645b
9 changed files with 82 additions and 16 deletions

View file

@ -42,3 +42,6 @@ hr
background: image_url('bg.jpg')
color: white !important
background-size: 100%
.semifooter
padding: 42px 0 80px 0

View file

@ -53,6 +53,7 @@ class Domain < ActiveRecord::Base
end
after_save :manage_automatic_statuses
after_save :update_whois_body
after_save :update_whois_server
validates :name_dirty, domain_name: true, uniqueness: true
validates :period, numericality: { only_integer: true }
@ -118,6 +119,15 @@ class Domain < ActiveRecord::Base
return period.to_i.months if unit == 'm'
return period.to_i.years if unit == 'y'
end
def included
includes(
:registrar,
:nameservers,
{ tech_contacts: :registrar },
{ admin_contacts: :registrar }
)
end
end
def name=(value)
@ -228,12 +238,6 @@ class Domain < ActiveRecord::Base
log
end
def update_whois_server
wd = Whois::Domain.find_or_initialize_by(name: name)
wd.whois_body = whois_body
wd.save
end
# rubocop:disable Metrics/MethodLength
def update_whois_body
self.whois_body = <<-EOS
@ -260,14 +264,12 @@ class Domain < ActiveRecord::Base
created: #{registrar.created_at.to_s(:db)}
changed: #{registrar.updated_at.to_s(:db)}
EOS
update_whois_server
end
# rubocop:enable Metrics/MethodLength
def contacts_body
out = ''
admin_contacts.includes(:registrar).each do |c|
admin_contacts.each do |c|
out << 'Admin contact:'
out << "name: #{c.name}"
out << "email: #{c.email}"
@ -275,7 +277,7 @@ class Domain < ActiveRecord::Base
out << "created: #{c.created_at.to_s(:db)}"
end
tech_contacts.includes(:registrar).each do |c|
tech_contacts.each do |c|
out << 'Tech contact:'
out << "name: #{c.name}"
out << "email: #{c.email}"
@ -284,4 +286,10 @@ class Domain < ActiveRecord::Base
end
out
end
def update_whois_server
wd = Whois::Domain.find_or_initialize_by(name: name)
wd.whois_body = whois_body
wd.save
end
end

View file

@ -42,7 +42,7 @@
= t('settings')
%span.caret
%ul.dropdown-menu{role: "menu"}
%li.dropdown-header= t('accounting')
%li.dropdown-header= t('billing')
%li= link_to t('bank_statements'), admin_bank_statements_path
%li.divider
%li.dropdown-header= t('system')

View file

@ -39,7 +39,7 @@
- if can? :show, Invoice
- active_class = ['registrar/invoices'].include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t('accounting'), registrar_invoices_path
%li{class: active_class}= link_to t('billing'), registrar_invoices_path
- if can? :view, :registrar_xml_console
- active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil

View file

@ -4,13 +4,14 @@
= t('invoice_no', no: @invoice.id)
.col-sm-6
%h1.text-right.text-center-xs
= link_to(t('back_to_accounting'), registrar_invoices_path, class: 'btn btn-default')
= link_to(t('back_to_billing'), registrar_invoices_path, class: 'btn btn-default')
%hr
.row
.col-md-6= render 'registrar/invoices/partials/banklinks'
.col-md-6= render 'registrar/invoices/partials/details'
.row
.col-md-6= render 'registrar/invoices/partials/seller'
.col-md-6= render 'registrar/invoices/partials/buyer'
.row
.col-md-12= render 'registrar/invoices/partials/items'
.row.semifooter
.col-md-12.text-right= render 'registrar/invoices/partials/banklinks'