mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
1088869472-methods_for_archive
This commit is contained in:
parent
2fdfdcb442
commit
2fe026715a
8 changed files with 186 additions and 8 deletions
|
@ -1,10 +1,10 @@
|
|||
class Admin::DomainVersionsController < AdminController
|
||||
load_and_authorize_resource
|
||||
#class Admin::DomainVersionsController < AdminController
|
||||
#load_and_authorize_resource
|
||||
|
||||
# rubocop:disable Style/GuardClause
|
||||
def index
|
||||
@domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
||||
@versions = @domain.versions
|
||||
#def index
|
||||
# @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
||||
# @versions = @domain.versions
|
||||
|
||||
# Depricated it had to load legal document. We may do it by parsing and adding link.
|
||||
# if @domain.pending_json.present?
|
||||
|
@ -13,6 +13,6 @@ class Admin::DomainVersionsController < AdminController
|
|||
# @pending_domain = Epp::Domain.find(@domain.id)
|
||||
# @pending_domain.update(frame, @pending_user, false)
|
||||
# end
|
||||
end
|
||||
#end
|
||||
# rubocop:enable Style/GuardClause
|
||||
end
|
||||
#end
|
||||
|
|
|
@ -77,6 +77,11 @@ class Admin::DomainsController < AdminController
|
|||
redirect_to [:admin, @domain]
|
||||
end
|
||||
|
||||
def versions
|
||||
@domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
||||
@versions = @domain.versions
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
|
|
7
app/controllers/admin/domains_versions_controller.rb
Normal file
7
app/controllers/admin/domains_versions_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Admin::DomainsVersionsController < AdminController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
end
|
|
@ -95,6 +95,7 @@ class Ability
|
|||
can :manage, ReservedDomain
|
||||
can :manage, ZonefileSetting
|
||||
can :manage, DomainVersion
|
||||
can :manage, ContactVersion
|
||||
can :manage, Pricelist
|
||||
can :manage, User
|
||||
can :manage, ApiUser
|
||||
|
|
105
app/views/admin/domains/partials/_version.haml
Normal file
105
app/views/admin/domains/partials/_version.haml
Normal file
|
@ -0,0 +1,105 @@
|
|||
- statuses_link ||= false
|
||||
- version ||= false
|
||||
- domain ||= false
|
||||
- pending_user ||= false
|
||||
|
||||
- if domain.present?
|
||||
- if version # normal history
|
||||
- children = HashWithIndifferentAccess.new(version.children)
|
||||
- nameservers = Nameserver.where(id: children[:nameservers])
|
||||
- tech_contacts = Contact.where(id: children[:tech_contacts])
|
||||
- admin_contacts = Contact.where(id: children[:admin_contacts])
|
||||
- registrant = Contact.where(id: children[:registrant])
|
||||
- event = version.event
|
||||
- creator = plain_username(version.terminator)
|
||||
- else # pending history
|
||||
- nameservers = domain.nameservers
|
||||
- tech_contacts = domain.tech_contacts
|
||||
- admin_contacts = domain.admin_contacts
|
||||
- registrant = [domain.registrant]
|
||||
- creator = pending_user.try(:username)
|
||||
- event = 'pending'
|
||||
|
||||
%td
|
||||
%p.nowrap
|
||||
= l(domain.updated_at, format: :shorts)
|
||||
- if statuses_link
|
||||
%br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id])
|
||||
|
||||
%p.text-right
|
||||
= event
|
||||
%br
|
||||
= creator
|
||||
|
||||
%td
|
||||
%p
|
||||
- if domain.statuses.present?
|
||||
- domain.statuses.each do |s|
|
||||
= s
|
||||
- if domain.status_notes.present?
|
||||
- notes = domain.status_notes[s]
|
||||
- if notes
|
||||
%br
|
||||
%i= notes
|
||||
%br
|
||||
- if domain.pending_json.present?
|
||||
%p
|
||||
= link_to t(:pending_epp), '#', class: 'js-pending-toggle'
|
||||
|
||||
%td
|
||||
%p
|
||||
= "#{domain.period}#{domain.period_unit}"
|
||||
%br
|
||||
= "#{l(domain.valid_from, format: :date)}"
|
||||
%br
|
||||
= "#{l(domain.valid_to, format: :date)}"
|
||||
|
||||
%td
|
||||
- registrant.each do |r|
|
||||
%p
|
||||
= r[:name]
|
||||
= r[:phone]
|
||||
= r[:email]
|
||||
%p
|
||||
= r[:code]
|
||||
|
||||
%td
|
||||
- admin_contacts.each do |ac|
|
||||
%p
|
||||
= ac[:name]
|
||||
= ac[:phone]
|
||||
= ac[:email]
|
||||
%p
|
||||
= ac[:code]
|
||||
|
||||
%td
|
||||
- tech_contacts.each do |tc|
|
||||
%p
|
||||
= tc[:name]
|
||||
= tc[:phone]
|
||||
= tc[:email]
|
||||
%p
|
||||
= tc[:code]
|
||||
|
||||
%td
|
||||
%p
|
||||
- nameservers.each do |ns|
|
||||
= ns[:hostname]
|
||||
%br
|
||||
= ns[:ipv4]
|
||||
= ns[:ipv6]
|
||||
|
||||
%td
|
||||
%p
|
||||
= domain.registrar.name
|
||||
|
||||
- if domain.pending_json.present?
|
||||
%tr.js-pending{ style: 'display: none;' }
|
||||
%td{colspan: 8}
|
||||
= preserve do
|
||||
%pre
|
||||
- formatted_req = Nokogiri::XML(domain.pending_json['frame'])
|
||||
- if formatted_req.errors.none?
|
||||
= formatted_req
|
||||
- else
|
||||
= domain.pending_json['frame']
|
44
app/views/admin/domains/versions.haml
Normal file
44
app/views/admin/domains/versions.haml
Normal file
|
@ -0,0 +1,44 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:back_to_domain), [:admin, @domain], class: 'btn btn-default')
|
||||
= render 'shared/title', name: "#{t(:history)}: #{@domain.name}"
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
%table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-1'}= t(:timestap)
|
||||
%th{class: 'col-xs-2'}= t(:statuses)
|
||||
%th{class: 'col-xs-1'}= t(:period)
|
||||
%th{class: 'col-xs-2'}= t(:registrant)
|
||||
%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(:registrar)
|
||||
|
||||
%tbody
|
||||
- if @pending_domain.present?
|
||||
%tr.small
|
||||
= render 'admin/domains/partials/version',
|
||||
domain: @pending_domain, pending_user: @pending_user, statuses_link: true
|
||||
|
||||
-# current version
|
||||
- if @domain.versions.present?
|
||||
%tr.small
|
||||
= render 'admin/domains/partials/version',
|
||||
domain: @domain, version: @domain.versions.last
|
||||
|
||||
-# all other older versions
|
||||
- @domain.versions.not_creates.reverse.each do |version|
|
||||
%tr.small
|
||||
= render 'admin/domains/partials/version',
|
||||
domain: version.reify, version: version.previous
|
||||
|
||||
:coffee
|
||||
$(document).on 'click', '.js-pending-toggle', (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
$(document).on 'mousedown', '.js-pending-toggle', (e) ->
|
||||
target = $(e.target)
|
||||
target.parents('tr').next('tr.js-pending').toggle()
|
|
@ -57,6 +57,10 @@
|
|||
%li= link_to t(:invoices), admin_invoices_path
|
||||
%li= link_to t(:account_activities), admin_account_activities_path
|
||||
%li.divider
|
||||
%li.dropdown-header= t(:archive)
|
||||
%li= link_to t(:domains_history), admin_domains_versions_path
|
||||
%li= link_to t(:contacts_history), admin_contacts_versions_path
|
||||
%li.divider
|
||||
%li.dropdown-header= t(:system)
|
||||
%li= link_to t(:settings), admin_settings_path
|
||||
%li= link_to t(:zonefile), admin_zonefile_settings_path
|
||||
|
|
|
@ -192,7 +192,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
resources :domains do
|
||||
resources :domain_versions
|
||||
resources :domain_versions, controller: 'domains', action: 'versions'
|
||||
resources :pending_updates
|
||||
resources :pending_deletes
|
||||
member do
|
||||
|
@ -201,6 +201,18 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :domains_versions do
|
||||
collection do
|
||||
get 'search'
|
||||
end
|
||||
end
|
||||
|
||||
resources :contacts_versions do
|
||||
collection do
|
||||
get 'search'
|
||||
end
|
||||
end
|
||||
|
||||
resources :settings
|
||||
|
||||
resources :blocked_domains
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue