mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 15:06:23 +02:00
Add missing partial and wildcard search on /admin/repp_logs
This commit is contained in:
parent
1106893a87
commit
2cff7d93fd
2 changed files with 8 additions and 12 deletions
|
@ -5,7 +5,7 @@ module Admin
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
# rubocop:disable Metrics/MethodLength
|
||||||
def index
|
def index
|
||||||
@q = ApiLog::ReppLog.ransack(params[:q])
|
@q = ApiLog::ReppLog.ransack(PartialSearchFormatter.format(params[:q]))
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
|
||||||
@repp_logs = @q.result
|
@repp_logs = @q.result
|
||||||
|
@ -32,16 +32,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? &&
|
||||||
|
params[:created_after].present?
|
||||||
|
|
||||||
default_date = params[:created_after]
|
default_date = params[:created_after]
|
||||||
|
default_date = 'today' unless %w[today tomorrow yesterday].include?(default_date)
|
||||||
|
|
||||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||||
default_date = 'today'
|
|
||||||
end
|
|
||||||
|
|
||||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,13 +20,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)
|
||||||
-# = f.search_field :api_user_registrar_cont, class: 'form-control', placeholder: t(:registrar_name), autocomplete: 'off'
|
|
||||||
.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