mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 22:16:19 +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
|
||||
def index
|
||||
@q = ApiLog::EppLog.ransack(params[:q])
|
||||
@q = ApiLog::EppLog.ransack(PartialSearchFormatter.format(params[:q]))
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
|
||||
@epp_logs = @q.result
|
||||
|
@ -30,15 +30,13 @@ module Admin
|
|||
def set_default_dates
|
||||
params[:q] ||= {}
|
||||
|
||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||
default_date = params[:created_after]
|
||||
return unless params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? &&
|
||||
params[:created_after].present?
|
||||
|
||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||
default_date = 'today'
|
||||
end
|
||||
default_date = params[:created_after]
|
||||
default_date = 'today' unless %w[today tomorrow yesterday].include?(default_date)
|
||||
|
||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||
end
|
||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
.col-md-3
|
||||
.form-group
|
||||
= 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
|
||||
.col-md-3
|
||||
.form-group
|
||||
= 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
|
||||
.form-group
|
||||
= f.label t(:created_after)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue