mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 15:14:47 +02:00
added filter for domain and contact histories
This commit is contained in:
parent
34e16ab8e8
commit
15c606f76a
4 changed files with 28 additions and 26 deletions
|
@ -7,11 +7,9 @@ module Admin
|
|||
def index
|
||||
params[:q] ||= {}
|
||||
|
||||
@q = Version::ContactVersion.ransack(params[:q])
|
||||
@versions = @q.result.page(params[:page])
|
||||
search_params = params[:q].deep_dup
|
||||
search_params = params[:q].deep_dup.except(:created_at_gteq, :created_at_lteq)
|
||||
|
||||
where_s = "1=1"
|
||||
where_s = '1=1'
|
||||
|
||||
search_params.each do |key, value|
|
||||
next if value.empty?
|
||||
|
|
|
@ -7,21 +7,19 @@ module Admin
|
|||
def index
|
||||
params[:q] ||= {}
|
||||
|
||||
@q = Version::DomainVersion.includes(:item).ransack(params[:q])
|
||||
@versions = @q.result.page(params[:page])
|
||||
search_params = params[:q].deep_dup
|
||||
search_params = params[:q].deep_dup.except(:created_at_gteq, :created_at_lteq)
|
||||
|
||||
if search_params[:registrant].present?
|
||||
registrants = Contact.where("name ilike ?", "%#{search_params[:registrant].strip}%")
|
||||
registrants = Contact.where('name ilike ?', "%#{search_params[:registrant].strip}%")
|
||||
search_params.delete(:registrant)
|
||||
end
|
||||
|
||||
if search_params[:registrar].present?
|
||||
registrars = Registrar.where("name ilike ?", "%#{search_params[:registrar].strip}%")
|
||||
registrars = Registrar.where('name ilike ?', "%#{search_params[:registrar].strip}%")
|
||||
search_params.delete(:registrar)
|
||||
end
|
||||
|
||||
where_s = "1=1"
|
||||
where_s = '1=1'
|
||||
|
||||
search_params.each do |key, value|
|
||||
next if value.empty?
|
||||
|
@ -39,11 +37,11 @@ module Admin
|
|||
if registrants.present?
|
||||
where_s += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id}'" }.join ','})"
|
||||
end
|
||||
where_s += " AND 1=0" if registrants == []
|
||||
where_s += ' AND 1=0' if registrants == []
|
||||
if registrars.present?
|
||||
where_s += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id}'" }.join ','})"
|
||||
end
|
||||
where_s += " AND 1=0" if registrars == []
|
||||
where_s += ' AND 1=0' if registrars == []
|
||||
|
||||
versions = Version::DomainVersion.includes(:item).where(where_s).order(created_at: :desc, id: :desc)
|
||||
@q = versions.ransack(params[:q])
|
||||
|
|
|
@ -22,7 +22,13 @@
|
|||
= select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy'], ['Create', 'create']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||
.row
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_at_from)
|
||||
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from)
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_at_until)
|
||||
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until)
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:results_per_page)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:registrar_name)
|
||||
= select_tag '[q][registrar]', options_for_select(Registrar.all.map { |x| [x, x.name] }, selected: params[:q][:registrar]), { include_blank: true, class: 'form-control', placeholder: t('.registrant')}
|
||||
= select_tag '[q][registrar]', options_for_select(Registrar.all.map { |r| [r.name] }, selected: params[:q][:registrar]), { include_blank: true, class: 'form-control', placeholder: t('.registrant')}
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag :action
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue