mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 09:00:02 +02:00
Merge branch 'master' of github.com:domify/registry
Conflicts: db/schema.rb
This commit is contained in:
commit
2dfa65645b
9 changed files with 82 additions and 16 deletions
|
@ -1,3 +1,7 @@
|
|||
15.04.2015
|
||||
|
||||
* Added whois tasks, more info with rake -T whois
|
||||
|
||||
02.04.2015
|
||||
|
||||
* Depricated DelayedJob, kill all running delayed jobs if needed
|
||||
|
|
|
@ -42,3 +42,6 @@ hr
|
|||
background: image_url('bg.jpg')
|
||||
color: white !important
|
||||
background-size: 100%
|
||||
|
||||
.semifooter
|
||||
padding: 42px 0 80px 0
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -653,10 +653,9 @@ en:
|
|||
vat: 'VAT (%{vat_prc}%)'
|
||||
unpaid: 'Unpaid'
|
||||
your_current_credit_account_balance_is: 'Your current credit account balance is %{balance} EUR'
|
||||
accounting: 'Accounting'
|
||||
billing: 'Billing'
|
||||
your_account: 'Your account'
|
||||
pay_by_bank_link: 'Pay by bank link'
|
||||
back_to_accounting: 'Back to accounting'
|
||||
issue_date: 'Issue date'
|
||||
due_date: 'Due date'
|
||||
payment_term: 'Payment term'
|
||||
|
@ -676,6 +675,7 @@ en:
|
|||
import_th6_bank_statement: 'Import TH6 bank statement'
|
||||
back_to_bank_statements: 'Back to bank statements'
|
||||
back_to_bank_statement: 'Back to bank statement'
|
||||
back_to_billing: 'Back to billing'
|
||||
imported_at: 'Imported at'
|
||||
bank_statement: 'Bank statement'
|
||||
bank_transactions: 'Bank transactions'
|
||||
|
|
17
db/migrate/20150414151357_data_update.rb
Normal file
17
db/migrate/20150414151357_data_update.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class DataUpdate < ActiveRecord::Migration
|
||||
def change
|
||||
Registrar.where(
|
||||
name: 'EIS',
|
||||
reg_no: '90010019',
|
||||
phone: '+372 727 1000',
|
||||
country_code: 'EE',
|
||||
vat_no: 'EE101286464',
|
||||
email: 'info@internet.ee',
|
||||
state: 'Harjumaa',
|
||||
city: 'Tallinn',
|
||||
street: 'Paldiski mnt 80',
|
||||
zip: '10617',
|
||||
url: 'www.internet.ee'
|
||||
).first_or_create!
|
||||
end
|
||||
end
|
33
lib/tasks/whois.rake
Normal file
33
lib/tasks/whois.rake
Normal file
|
@ -0,0 +1,33 @@
|
|||
namespace :whois do
|
||||
desc 'Delete whois database data and import all from Registry (fast)'
|
||||
task reset: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Reset whois database and sync..."
|
||||
domains = Domain.pluck(:name, :whois_body)
|
||||
Whois::Domain.delete_all
|
||||
Whois::Domain.import([:name, :whois_body], domains)
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Sync whois database without reset (slow)'
|
||||
task sync: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Sync whois database..."
|
||||
Domain.select(:id, :name, :whois_body).find_each(batch_size: 100000).with_index do |d, index|
|
||||
d.update_whois_server
|
||||
print '.' if index % 100 == 0
|
||||
end
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Regenerate whois_body at Registry master database (slow)'
|
||||
task generate: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Update Registry records..."
|
||||
Domain.included.find_each(batch_size: 100000).with_index do |d, index|
|
||||
d.update_columns(whois_body: d.update_whois_body)
|
||||
print '.' if index % 100 == 0
|
||||
end
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue