mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
fixed admin pagination
This commit is contained in:
parent
f81c06673c
commit
11029e83ce
25 changed files with 126 additions and 15 deletions
|
@ -23,6 +23,7 @@ module Admin
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
|
@count = @q.result.count
|
||||||
|
|
||||||
if params[:page] && params[:page].to_i > 1
|
if params[:page] && params[:page].to_i > 1
|
||||||
@sum = @q.result.limit(@account_activities.offset_value).sum(:sum) +
|
@sum = @q.result.limit(@account_activities.offset_value).sum(:sum) +
|
||||||
|
|
|
@ -6,6 +6,8 @@ module Admin
|
||||||
def index
|
def index
|
||||||
@q = AdminUser.search(params[:q])
|
@q = AdminUser.search(params[:q])
|
||||||
@admin_users = @q.result.page(params[:page]).order(:username)
|
@admin_users = @q.result.page(params[:page]).order(:username)
|
||||||
|
@count = @q.result.count
|
||||||
|
@admin_users = @admin_users.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -5,6 +5,8 @@ module Admin
|
||||||
def index
|
def index
|
||||||
@q = ApiUser.includes(:registrar).search(params[:q])
|
@q = ApiUser.includes(:registrar).search(params[:q])
|
||||||
@api_users = @q.result.page(params[:page])
|
@api_users = @q.result.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@api_users = @api_users.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -8,6 +8,8 @@ module Admin
|
||||||
@q = BankStatement.search(params[:q])
|
@q = BankStatement.search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
@bank_statements = @q.result.page(params[:page])
|
@bank_statements = @q.result.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@bank_statements = @bank_statements.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -29,6 +29,8 @@ module Admin
|
||||||
@q.sorts = ['zone_id asc', 'duration asc', 'operation_category asc',
|
@q.sorts = ['zone_id asc', 'duration asc', 'operation_category asc',
|
||||||
'valid_from desc', 'valid_to asc'] if @q.sorts.empty?
|
'valid_from desc', 'valid_to asc'] if @q.sorts.empty?
|
||||||
@prices = @q.result.page(params[:page])
|
@prices = @q.result.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@prices = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -5,7 +5,9 @@ module Admin
|
||||||
|
|
||||||
# GET /bounced_mail_addresses
|
# GET /bounced_mail_addresses
|
||||||
def index
|
def index
|
||||||
@bounced_mail_addresses = BouncedMailAddress.all.order(created_at: :desc)
|
@q = BouncedMailAddress.all.order(created_at: :desc).search(params[:q])
|
||||||
|
@bounced_mail_addresses = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
|
@count = @q.result.count
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /bounced_mail_addresses/1
|
# GET /bounced_mail_addresses/1
|
||||||
|
|
|
@ -5,7 +5,9 @@ module Admin
|
||||||
before_action :load_zone, only: %i[edit update destroy]
|
before_action :load_zone, only: %i[edit update destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@zones = ::DNS::Zone.all
|
@q = ::DNS::Zone.search(params[:q])
|
||||||
|
@count = @q.result.count
|
||||||
|
@zones = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -11,6 +11,8 @@ module Admin
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
@epp_logs = @epp_logs.page(params[:page])
|
@epp_logs = @epp_logs.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@epp_logs = @epp_logs.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -36,6 +36,8 @@ module Admin
|
||||||
@q = Invoice.includes(:account_activity).search(params[:q])
|
@q = Invoice.includes(:account_activity).search(params[:q])
|
||||||
@q.sorts = 'number desc' if @q.sorts.empty?
|
@q.sorts = 'number desc' if @q.sorts.empty?
|
||||||
@invoices = @q.result.page(params[:page])
|
@invoices = @q.result.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@invoices = @invoices.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
def show; end
|
||||||
|
|
|
@ -8,6 +8,8 @@ module Admin
|
||||||
def index
|
def index
|
||||||
@q = Registrar.joins(:accounts).ordered.search(params[:q])
|
@q = Registrar.joins(:accounts).ordered.search(params[:q])
|
||||||
@registrars = @q.result.page(params[:page])
|
@registrars = @q.result.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@registrars = @registrars.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -11,6 +11,8 @@ module Admin
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||||
@repp_logs = @repp_logs.page(params[:page])
|
@repp_logs = @repp_logs.page(params[:page])
|
||||||
|
@count = @q.result.count
|
||||||
|
@repp_logs = @repp_logs.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -120,7 +120,7 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_webclient_ca
|
def validate_webclient_ca
|
||||||
return unless webclient_request?
|
return if webclient_request?
|
||||||
|
|
||||||
request_name = request.env['HTTP_SSL_CLIENT_S_DN_CN']
|
request_name = request.env['HTTP_SSL_CLIENT_S_DN_CN']
|
||||||
webclient_cn = ENV['webclient_cert_common_name'] || 'webclient'
|
webclient_cn = ENV['webclient_cert_common_name'] || 'webclient'
|
||||||
|
|
|
@ -46,5 +46,8 @@
|
||||||
%td{class: 'text-right'}= t(:total)
|
%td{class: 'text-right'}= t(:total)
|
||||||
%td{class: total > 0 ? 'text-success' : 'text-danger'}= total > 0 ? "+#{total} EUR" : "#{total} EUR"
|
%td{class: total > 0 ? 'text-success' : 'text-danger'}= total > 0 ? "+#{total} EUR" : "#{total} EUR"
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-6
|
||||||
= paginate @account_activities
|
= paginate @account_activities
|
||||||
|
.col-md-6.text-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
- content_for :actions do
|
- content_for :actions do
|
||||||
= link_to(t('.new_btn'), new_admin_admin_user_path, class: 'btn btn-primary')
|
= link_to(t('.new_btn'), new_admin_admin_user_path, class: 'btn btn-primary')
|
||||||
= render 'shared/title', name: t('.title')
|
= render 'shared/title', name: t('.title')
|
||||||
|
= render 'application/pagination'
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
@ -27,5 +28,7 @@
|
||||||
- else
|
- else
|
||||||
%td
|
%td
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-6
|
||||||
= paginate @admin_users
|
= paginate @admin_users
|
||||||
|
.col-md-6.text-right
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
<h1><%= t '.header' %></h1>
|
<h1><%= t '.header' %></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= render 'application/pagination' %>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
@ -29,7 +31,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<%= paginate @api_users %>
|
<%= paginate @api_users %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6 text-right">
|
||||||
|
<div class="pagination">
|
||||||
|
<%= t(:result_count, count: @count) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
- content_for :actions do
|
- content_for :actions do
|
||||||
= link_to(t(:add), new_admin_bank_statement_path, class: 'btn btn-primary')
|
= link_to(t(:add), new_admin_bank_statement_path, class: 'btn btn-primary')
|
||||||
= render 'shared/title', name: t(:bank_statements)
|
= render 'shared/title', name: t(:bank_statements)
|
||||||
|
= render 'application/pagination'
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
@ -28,5 +29,8 @@
|
||||||
- sc = 'text-danger' if x.not_binded?
|
- sc = 'text-danger' if x.not_binded?
|
||||||
%td{class: sc}= t(x.status)
|
%td{class: sc}= t(x.status)
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-6
|
||||||
= paginate @bank_statements
|
= paginate @bank_statements
|
||||||
|
.col-md-6.text-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
|
@ -2,18 +2,21 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label :status, class: 'col-sm-2 control-label' %>
|
<%= f.label :status, class: 'col-sm-2 control-label' %>
|
||||||
|
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-2">
|
||||||
<%= f.select :status, options_for_select(statuses, search.status), { include_blank: t('.all') },
|
<%= f.select :status, options_for_select(statuses, search.status), { include_blank: t('.all') },
|
||||||
class: 'form-control' %>
|
class: 'form-control' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<%= f.label :results_per_page, class: 'col-sm-2 control-label' %>
|
||||||
<div class="col-sm-offset-2 col-sm-8">
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
<%= f.submit t('.search_btn'), class: 'btn btn-primary', name: nil %>
|
<%= f.submit t('.search_btn'), class: 'btn btn-primary', name: nil %>
|
||||||
<%= link_to t('.reset_btn'), admin_prices_path,
|
<%= link_to t('.reset_btn'), admin_prices_path,
|
||||||
class: 'btn btn-default price-search-form-search-btn' %>
|
class: 'btn btn-default price-search-form-search-btn' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -33,9 +33,14 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<%= paginate @prices %>
|
<%= paginate @prices %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6 text-right">
|
||||||
|
<div class="pagination">
|
||||||
|
<%= t(:result_count, count: @count) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="alert alert-info"><%= t '.not_found' %></div>
|
<div class="alert alert-info"><%= t '.not_found' %></div>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<h1>Bounced Mail Addresses</h1>
|
<h1>Bounced Mail Addresses</h1>
|
||||||
|
|
||||||
|
<%= render 'application/pagination' %>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
@ -34,3 +36,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<%= paginate @bounced_mail_addresses %>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-right">
|
||||||
|
<div class="pagination">
|
||||||
|
<%= t(:result_count, count: @count) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @zones.present? %>
|
<% if @zones.present? %>
|
||||||
|
<%= render 'application/pagination' %>
|
||||||
<table class="table table-hover table-bordered table-wrapped">
|
<table class="table table-hover table-bordered table-wrapped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -26,3 +27,13 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="alert alert-info"><%= t '.not_found' %></div>
|
<div class="alert alert-info"><%= t '.not_found' %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<%= paginate @zones %>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-right">
|
||||||
|
<div class="pagination">
|
||||||
|
<%= t(:result_count, count: @count) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%hr
|
%hr
|
||||||
= paginate @epp_logs
|
= paginate @epp_logs
|
||||||
|
.pull-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count) if @count > 0
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
|
@ -69,3 +72,6 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= paginate @epp_logs
|
= paginate @epp_logs
|
||||||
|
.pull-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
- content_for :actions do
|
- content_for :actions do
|
||||||
= link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary')
|
= link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary')
|
||||||
= render 'shared/title', name: t(:invoices)
|
= render 'shared/title', name: t(:invoices)
|
||||||
|
= render 'application/pagination'
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.table-responsive
|
.table-responsive
|
||||||
|
@ -32,5 +34,8 @@
|
||||||
- else
|
- else
|
||||||
%td.text-danger= t(:unpaid)
|
%td.text-danger= t(:unpaid)
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-6
|
||||||
= paginate @invoices
|
= paginate @invoices
|
||||||
|
.col-md-6.text-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= render 'application/pagination' %>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
@ -62,7 +64,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<%= paginate @registrars %>
|
<%= paginate @registrars %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6 text-right">
|
||||||
|
<div class="pagination">
|
||||||
|
<%= t(:result_count, count: @count) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
= paginate @repp_logs
|
||||||
|
.pull-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count) if @count > 0
|
||||||
.table-responsive
|
.table-responsive
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
%thead
|
%thead
|
||||||
|
@ -66,3 +70,6 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= paginate @repp_logs
|
= paginate @repp_logs
|
||||||
|
.pull-right
|
||||||
|
.pagination
|
||||||
|
= t(:result_count, count: @count)
|
||||||
|
|
17
app/views/application/_pagination.html.erb
Normal file
17
app/views/application/_pagination.html.erb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<%= search_form_for([:admin, @q], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f| %>
|
||||||
|
<div class="pull-right">
|
||||||
|
<div class=".text-right">
|
||||||
|
<div class="form-inline">
|
||||||
|
<%= label_tag t(:results_per_page) %>
|
||||||
|
<%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
|
||||||
|
<button class="btn btn-primary" align="right">
|
||||||
|
|
||||||
|
<span class="glyphicon glyphicon-ok push-right"></span>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="row form-group"></div>
|
Loading…
Add table
Add a link
Reference in a new issue