story#115762063 - render link to pure history

This commit is contained in:
Vladimir Krylov 2016-03-30 17:11:50 +03:00
commit 03784ad1e3
3 changed files with 24 additions and 5 deletions

View file

@ -738,12 +738,17 @@ class Domain < ActiveRecord::Base
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
# small optimization that we'are using to_a if it was done already
# otherwise just getting ids
def children_log
log = HashWithIndifferentAccess.new
log[:admin_contacts] = admin_contact_ids
log[:tech_contacts] = tech_contact_ids
log[:nameservers] = nameserver_ids
log[:dnskeys] = dnskey_ids
types = %i(admin_contacts tech_contacts nameservers dnskeys domain_statuses)
types.each do |rel|
ids = send(rel).loaded? ? send(rel).reject(&:marked_for_destruction?).map(&:id) : send(rel).pluck(:id)
log[rel] = ids
end
log[:legal_documents]= [legal_document_id]
log[:registrant] = [registrant_id]
log

View file

@ -7,6 +7,7 @@
- if version # normal history
- children = HashWithIndifferentAccess.new(version.children)
- nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at)
- dnskeys = Dnskey.all_versions_for(children[:dnskeys], version.created_at)
- tech_contacts = Contact.all_versions_for(children[:tech_contacts], version.created_at)
- admin_contacts = Contact.all_versions_for(children[:admin_contacts], version.created_at)
- registrant = Contact.all_versions_for(children[:registrant], version.created_at)
@ -14,6 +15,7 @@
- creator = plain_username(version.terminator)
- else # pending history
- nameservers = domain.nameservers
- dnskeys = domain.dnskeys
- tech_contacts = domain.tech_contacts
- admin_contacts = domain.admin_contacts
- registrant = [domain.registrant]
@ -30,6 +32,9 @@
= event
%br
= creator
- if version
%p.text-right
= link_to "Pure history", admin_domain_version_path(version)
%td{class: changing_css_class(version,"statuses")}
%p
@ -95,6 +100,14 @@
= ns[:ipv4].presence
= ns[:ipv6].presence
%br
%td
- Array(dnskeys).each do |ns|
%p
= ns.flags
= ns.protocol
= ns.alg
%br
= ns.attributes.except("id", "domain_id", "updated_at", "legacy_domain_id")
%td{class: changing_css_class(version,"registrar_id")}
- if domain.registrar

View file

@ -15,6 +15,7 @@
%th{class: 'col-xs-2'}= t(:admin)
%th{class: 'col-xs-2'}= t(:tech)
%th{class: 'col-xs-2'}= t(:nameservers)
%th{class: 'col-xs-2'}= t(:dnskeys)
%th{class: 'col-xs-2'}= t(:registrar)
%tbody