mirror of
https://github.com/internetee/registry.git
synced 2025-05-31 09:53:56 +02:00
108869472-templates
This commit is contained in:
parent
2fe026715a
commit
f142539827
6 changed files with 88 additions and 16 deletions
39
app/controllers/admin/contact_versions_controller.rb
Normal file
39
app/controllers/admin/contact_versions_controller.rb
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
class Admin::ContactVersionsController < AdminController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
def index
|
||||||
|
params[:q] ||= {}
|
||||||
|
@q = ContactVersion.search(params[:q])
|
||||||
|
@versions = @q.result.page(params[:page])
|
||||||
|
|
||||||
|
versions = ContactVersion.all
|
||||||
|
|
||||||
|
normalize_search_parameters do
|
||||||
|
@q = versions.search(params[:q])
|
||||||
|
@versions = @q.result.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def search
|
||||||
|
render json: ContactVersion.search_by_query(params[:q])
|
||||||
|
end
|
||||||
|
|
||||||
|
def normalize_search_parameters
|
||||||
|
ca_cache = params[:q][:created_at_lteq]
|
||||||
|
begin
|
||||||
|
end_time = params[:q][:created_at_lteq].try(:to_date)
|
||||||
|
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
||||||
|
end_time = params[:q][:updated_at_gteq].try(:to_date)
|
||||||
|
params[:q][:updated_at_lteq] = end_time.try(:end_of_day)
|
||||||
|
rescue
|
||||||
|
logger.warn('Invalid date')
|
||||||
|
end
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
params[:q][:created_at_lteq] = ca_cache
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,8 +1,8 @@
|
||||||
#class Admin::DomainVersionsController < AdminController
|
class Admin::DomainVersionsController < AdminController
|
||||||
#load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
# rubocop:disable Style/GuardClause
|
# rubocop:disable Style/GuardClause
|
||||||
#def index
|
def index
|
||||||
# @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
# @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first
|
||||||
# @versions = @domain.versions
|
# @versions = @domain.versions
|
||||||
|
|
||||||
|
@ -13,6 +13,6 @@
|
||||||
# @pending_domain = Epp::Domain.find(@domain.id)
|
# @pending_domain = Epp::Domain.find(@domain.id)
|
||||||
# @pending_domain.update(frame, @pending_user, false)
|
# @pending_domain.update(frame, @pending_user, false)
|
||||||
# end
|
# end
|
||||||
#end
|
end
|
||||||
# rubocop:enable Style/GuardClause
|
# rubocop:enable Style/GuardClause
|
||||||
#end
|
end
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
class Admin::DomainsVersionsController < AdminController
|
|
||||||
load_and_authorize_resource
|
|
||||||
|
|
||||||
def index
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
40
app/views/admin/contact_versions/index.haml
Normal file
40
app/views/admin/contact_versions/index.haml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
= render 'shared/title', name: t(:contact_versions)
|
||||||
|
|
||||||
|
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.table-responsive
|
||||||
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'name', t(:ID))
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'code', t(:item_id))
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'ident', t(:event))
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'email', t(:object))
|
||||||
|
%th{class: 'col-xs-2'}
|
||||||
|
= sort_link(@q, 'registrar_name', t(:registrar))
|
||||||
|
%tbody
|
||||||
|
- @versions.each do |version|
|
||||||
|
%tr
|
||||||
|
%td= 1
|
||||||
|
%td= 2
|
||||||
|
%td= 3
|
||||||
|
%td= 4
|
||||||
|
%td= 5
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
= paginate @versions
|
||||||
|
.col-md-6.text-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @contacts.total_count)
|
||||||
|
|
||||||
|
:coffee
|
||||||
|
$(".js-reset-form").on "click", (e) ->
|
||||||
|
e.preventDefault();
|
||||||
|
window.location = "#{admin_contact_versions_path}"
|
|
@ -58,8 +58,8 @@
|
||||||
%li= link_to t(:account_activities), admin_account_activities_path
|
%li= link_to t(:account_activities), admin_account_activities_path
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t(:archive)
|
%li.dropdown-header= t(:archive)
|
||||||
%li= link_to t(:domains_history), admin_domains_versions_path
|
%li= link_to t(:domains_history), admin_domain_versions_path
|
||||||
%li= link_to t(:contacts_history), admin_contacts_versions_path
|
%li= link_to t(:contacts_history), admin_contact_versions_path
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t(:system)
|
%li.dropdown-header= t(:system)
|
||||||
%li= link_to t(:settings), admin_settings_path
|
%li= link_to t(:settings), admin_settings_path
|
||||||
|
|
|
@ -201,13 +201,13 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :domains_versions do
|
resources :domain_versions do
|
||||||
collection do
|
collection do
|
||||||
get 'search'
|
get 'search'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :contacts_versions do
|
resources :contact_versions do
|
||||||
collection do
|
collection do
|
||||||
get 'search'
|
get 'search'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue