mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 06:56:23 +02:00
Add missing partial and wildcard search on /admin/epp_logs
This commit is contained in:
parent
e588344332
commit
1106893a87
2 changed files with 8 additions and 10 deletions
|
@ -5,7 +5,7 @@ module Admin
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
# rubocop:disable Metrics/MethodLength
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::EppLog.ransack(params[:q])
|
@q = ApiLog::EppLog.ransack(PartialSearchFormatter.format(params[:q]))
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@epp_logs = @q.result
|
@epp_logs = @q.result
|
||||||
|
@ -30,15 +30,13 @@ module Admin
|
||||||
def set_default_dates
|
def set_default_dates
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
return unless params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? &&
|
||||||
default_date = params[:created_after]
|
params[:created_after].present?
|
||||||
|
|
||||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
default_date = params[:created_after]
|
||||||
default_date = 'today'
|
default_date = 'today' unless %w[today tomorrow yesterday].include?(default_date)
|
||||||
end
|
|
||||||
|
|
||||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label :api_user
|
= f.label :api_user
|
||||||
= f.search_field :api_user_name_cont, class: 'form-control', placeholder: t(:api_user), autocomplete: 'off'
|
= f.search_field :api_user_name_matches, value: params[:q][:api_user_name_matches], class: 'form-control', placeholder: t(:api_user), autocomplete: 'off'
|
||||||
.row
|
.row
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label :registrar
|
= f.label :registrar
|
||||||
= f.select :api_user_registrar_cont, Registrar.all.map { |x| [x, x.name] }, { include_blank: true }, class: 'form-control', placeholder: t(:choose)
|
= f.select :api_user_registrar_matches, Registrar.all.map { |x| [x, x.name] }, { include_blank: true }, class: 'form-control', placeholder: t(:choose)
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:created_after)
|
= f.label t(:created_after)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue