mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +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
|
||||
when 'event'
|
||||
whereS += " AND event = '#{value}'"
|
||||
when 'name'
|
||||
whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')"
|
||||
else
|
||||
whereS += create_where_string(key, value)
|
||||
end
|
||||
|
@ -47,11 +49,12 @@ class Admin::DomainVersionsController < AdminController
|
|||
per_page = 7
|
||||
@version = DomainVersion.find(params[:id])
|
||||
@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
|
||||
# then we cacl which page it is
|
||||
if params[:page].blank?
|
||||
counter = @versions.where("id > ?", @version.id).count
|
||||
counter = @versions_map.index(@version.id) + 1
|
||||
page = counter / per_page
|
||||
page += 1 if (counter % per_page) != 0
|
||||
params[:page] = page
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
- 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.try(:name)
|
||||
= " ".html_safe
|
||||
= "(#{t(:deleted)})"
|
||||
%td
|
||||
- if domain.registrar
|
||||
= link_to(domain.registrar, admin_registrar_path(domain.registrar))
|
||||
|
|
|
@ -104,16 +104,16 @@
|
|||
= domain.registrar.name
|
||||
%span{:style => "margin: 20px 20px; clear:both;"}
|
||||
|
||||
- if @version.previous
|
||||
- if prev = @versions_map[(@versions_map.index(@version.id) - 1)]
|
||||
= link_to(t(:previous),
|
||||
admin_domain_version_path(@version.previous.id),
|
||||
admin_domain_version_path(prev),
|
||||
class: 'btn btn-primary')
|
||||
- else
|
||||
%a.btn.btn-primary.disabled{:href => "#"}
|
||||
%span= t(:previous)
|
||||
- if @version.next
|
||||
- if nxt = @versions_map[(@versions_map.index(@version.id) + 1)]
|
||||
= link_to(t(:next),
|
||||
admin_domain_version_path(@version.next.id),
|
||||
admin_domain_version_path(nxt),
|
||||
class: 'btn btn-default')
|
||||
- else
|
||||
%a.btn.btn-default.disabled{:href => "#"}
|
||||
|
|
|
@ -957,3 +957,4 @@ en:
|
|||
next: 'Next'
|
||||
previous: 'Previous'
|
||||
cant_match_version: 'Impossible match version with request'
|
||||
deleted: 'Deleted'
|
Loading…
Add table
Add a link
Reference in a new issue