mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
Merge branch '108869472-objects_archive' into staging
This commit is contained in:
commit
bae9cedf20
4 changed files with 11 additions and 5 deletions
|
@ -25,6 +25,8 @@ class Admin::DomainVersionsController < AdminController
|
||||||
case key
|
case key
|
||||||
when 'event'
|
when 'event'
|
||||||
whereS += " AND event = '#{value}'"
|
whereS += " AND event = '#{value}'"
|
||||||
|
when 'name'
|
||||||
|
whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
||||||
else
|
else
|
||||||
whereS += create_where_string(key, value)
|
whereS += create_where_string(key, value)
|
||||||
end
|
end
|
||||||
|
@ -47,11 +49,12 @@ class Admin::DomainVersionsController < AdminController
|
||||||
per_page = 7
|
per_page = 7
|
||||||
@version = DomainVersion.find(params[:id])
|
@version = DomainVersion.find(params[:id])
|
||||||
@versions = DomainVersion.where(item_id: @version.item_id).order(id: :desc)
|
@versions = DomainVersion.where(item_id: @version.item_id).order(id: :desc)
|
||||||
|
@versions_map = @versions.all.map(&:id)
|
||||||
|
|
||||||
# what we do is calc amount of results until needed version
|
# what we do is calc amount of results until needed version
|
||||||
# then we cacl which page it is
|
# then we cacl which page it is
|
||||||
if params[:page].blank?
|
if params[:page].blank?
|
||||||
counter = @versions.where("id > ?", @version.id).count
|
counter = @versions_map.index(@version.id) + 1
|
||||||
page = counter / per_page
|
page = counter / per_page
|
||||||
page += 1 if (counter % per_page) != 0
|
page += 1 if (counter % per_page) != 0
|
||||||
params[:page] = page
|
params[:page] = page
|
||||||
|
|
|
@ -69,6 +69,8 @@
|
||||||
- if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last
|
- if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last
|
||||||
- contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o[k]=v.last } ))
|
- contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o[k]=v.last } ))
|
||||||
= contact.try(:name)
|
= contact.try(:name)
|
||||||
|
= " ".html_safe
|
||||||
|
= "(#{t(:deleted)})"
|
||||||
%td
|
%td
|
||||||
- if domain.registrar
|
- if domain.registrar
|
||||||
= link_to(domain.registrar, admin_registrar_path(domain.registrar))
|
= link_to(domain.registrar, admin_registrar_path(domain.registrar))
|
||||||
|
|
|
@ -104,16 +104,16 @@
|
||||||
= domain.registrar.name
|
= domain.registrar.name
|
||||||
%span{:style => "margin: 20px 20px; clear:both;"}
|
%span{:style => "margin: 20px 20px; clear:both;"}
|
||||||
|
|
||||||
- if @version.previous
|
- if prev = @versions_map[(@versions_map.index(@version.id) - 1)]
|
||||||
= link_to(t(:previous),
|
= link_to(t(:previous),
|
||||||
admin_domain_version_path(@version.previous.id),
|
admin_domain_version_path(prev),
|
||||||
class: 'btn btn-primary')
|
class: 'btn btn-primary')
|
||||||
- else
|
- else
|
||||||
%a.btn.btn-primary.disabled{:href => "#"}
|
%a.btn.btn-primary.disabled{:href => "#"}
|
||||||
%span= t(:previous)
|
%span= t(:previous)
|
||||||
- if @version.next
|
- if nxt = @versions_map[(@versions_map.index(@version.id) + 1)]
|
||||||
= link_to(t(:next),
|
= link_to(t(:next),
|
||||||
admin_domain_version_path(@version.next.id),
|
admin_domain_version_path(nxt),
|
||||||
class: 'btn btn-default')
|
class: 'btn btn-default')
|
||||||
- else
|
- else
|
||||||
%a.btn.btn-default.disabled{:href => "#"}
|
%a.btn.btn-default.disabled{:href => "#"}
|
||||||
|
|
|
@ -957,3 +957,4 @@ en:
|
||||||
next: 'Next'
|
next: 'Next'
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
cant_match_version: 'Impossible match version with request'
|
cant_match_version: 'Impossible match version with request'
|
||||||
|
deleted: 'Deleted'
|
Loading…
Add table
Add a link
Reference in a new issue