mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Merge branch '108869472-objects_archive' into staging
This commit is contained in:
commit
b2f502924b
9 changed files with 97 additions and 15 deletions
|
@ -43,10 +43,19 @@ class Admin::DomainVersionsController < AdminController
|
|||
|
||||
def show
|
||||
per_page = 7
|
||||
@version = DomainVersion.find(params[:id])
|
||||
@q = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc).search
|
||||
@versions = @q.result.page(params[:page])
|
||||
@versions = @versions.per(per_page)
|
||||
@version = DomainVersion.find(params[:id])
|
||||
@versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc)
|
||||
|
||||
# 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("created_at > ?", @version.created_at).count
|
||||
page = counter / per_page
|
||||
page += 1 if (counter % per_page) != 0
|
||||
params[:page] = page
|
||||
end
|
||||
|
||||
@versions = @versions.page(params[:page]).per(per_page)
|
||||
end
|
||||
|
||||
def search
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
- registrant = Contact.all_versions_for(children[:registrant], @version.created_at)
|
||||
- event = @version.event
|
||||
- creator = plain_username(@version.terminator)
|
||||
- domain = Domain.new(@version.object.to_h)
|
||||
- @version.object_changes.to_h.each{|k,v| domain[k]=v.last}
|
||||
|
||||
= render 'shared/title', name: domain.name
|
||||
|
||||
|
@ -99,11 +97,8 @@
|
|||
%br
|
||||
|
||||
%dt= t(:registrar)
|
||||
%dd{class: changing_css_class(@version,"registrar_id")}
|
||||
= link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do
|
||||
= domain.registrar.name
|
||||
|
||||
%span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"}
|
||||
%dd= domain.registrar.name
|
||||
%div{:style => "margin: 20px 20px; clear:both;"}
|
||||
- if @version.previous
|
||||
= link_to(t(:previous),
|
||||
admin_domain_version_path(@version.previous.id),
|
||||
|
@ -123,15 +118,15 @@
|
|||
.panel.panel-default{:style => "min-height:450px;"}
|
||||
%ul.nav.nav-pills.nav-stacked
|
||||
- @versions.each do |vs|
|
||||
- if vs.id == @version.id and vs.reify
|
||||
- if vs.id == @version.id
|
||||
%li.active
|
||||
= link_to admin_domain_version_path(vs.id) do
|
||||
= link_to admin_domain_version_path(vs) do
|
||||
= l(vs.created_at, format: :short)
|
||||
= vs.event
|
||||
- else
|
||||
%li
|
||||
= link_to admin_domain_version_path(vs.id) do
|
||||
= link_to admin_domain_version_path(vs) do
|
||||
= l(vs.created_at, format: :short)
|
||||
= vs.event
|
||||
%span{:style => "padding-left:10px; position: absolute; bottom: 10px;"}
|
||||
= paginate @versions
|
||||
= paginate @versions, theme: :admin
|
||||
|
|
11
app/views/kaminari/admin/_first_page.html.haml
Normal file
11
app/views/kaminari/admin/_first_page.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
|||
-# Link to the "First" page
|
||||
-# available local variables
|
||||
-# url: url to the first page
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span.first
|
||||
- param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name
|
||||
- urlik = url_for( params.merge(param_name => 1, :only_path => true))
|
||||
= link_to_unless current_page.first?, t('views.pagination.first').html_safe, urlik, :remote => remote
|
8
app/views/kaminari/admin/_gap.html.haml
Normal file
8
app/views/kaminari/admin/_gap.html.haml
Normal file
|
@ -0,0 +1,8 @@
|
|||
-# Non-link tag that stands for skipped pages...
|
||||
-# available local variables
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span.page.gap
|
||||
= t('views.pagination.truncate').html_safe
|
9
app/views/kaminari/admin/_last_page.html.haml
Normal file
9
app/views/kaminari/admin/_last_page.html.haml
Normal file
|
@ -0,0 +1,9 @@
|
|||
-# Link to the "Last" page
|
||||
-# available local variables
|
||||
-# url: url to the last page
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span.last
|
||||
= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote
|
9
app/views/kaminari/admin/_next_page.html.haml
Normal file
9
app/views/kaminari/admin/_next_page.html.haml
Normal file
|
@ -0,0 +1,9 @@
|
|||
-# Link to the "Next" page
|
||||
-# available local variables
|
||||
-# url: url to the next page
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span.next
|
||||
= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote
|
12
app/views/kaminari/admin/_page.html.haml
Normal file
12
app/views/kaminari/admin/_page.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
|||
-# Link showing page number
|
||||
-# available local variables
|
||||
-# page: a page object for "this" page
|
||||
-# url: url to this page
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span{:class => "page#{' current' if page.current?}"}
|
||||
- param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name
|
||||
- urlik = url_for( params.merge(param_name => page.to_i, :only_path => true))
|
||||
= link_to_unless page.current?, page, urlik, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
|
18
app/views/kaminari/admin/_paginator.html.haml
Normal file
18
app/views/kaminari/admin/_paginator.html.haml
Normal file
|
@ -0,0 +1,18 @@
|
|||
-# The container tag
|
||||
-# available local variables
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
-# paginator: the paginator that renders the pagination tags inside
|
||||
= paginator.render do
|
||||
%nav.pagination
|
||||
= first_page_tag unless current_page.first?
|
||||
= prev_page_tag unless current_page.first?
|
||||
- each_page do |page|
|
||||
- if page.left_outer? || page.right_outer? || page.inside_window?
|
||||
= page_tag page
|
||||
- elsif !page.was_truncated?
|
||||
= gap_tag
|
||||
= next_page_tag unless current_page.last?
|
||||
= last_page_tag unless current_page.last?
|
11
app/views/kaminari/admin/_prev_page.html.haml
Normal file
11
app/views/kaminari/admin/_prev_page.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
|||
-# Link to the "Previous" page
|
||||
-# available local variables
|
||||
-# url: url to the previous page
|
||||
-# current_page: a page object for the currently displayed page
|
||||
-# total_pages: total number of pages
|
||||
-# per_page: number of items to fetch per page
|
||||
-# remote: data-remote
|
||||
%span.prev
|
||||
- param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name
|
||||
- urlik = url_for( params.merge(param_name => current_page.to_i - 1, :only_path => true))
|
||||
= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, urlik, :rel => 'prev', :remote => remote
|
Loading…
Add table
Add a link
Reference in a new issue