mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
Merge branch 'master' into 499-admin-wildcard-search
This commit is contained in:
parent
f93286c2e6
commit
fd6e625d25
49 changed files with 382 additions and 160 deletions
|
@ -1,13 +1,13 @@
|
|||
module Admin
|
||||
class ContactVersionsController < BaseController
|
||||
include ObjectVersionsHelper
|
||||
include ApplicationHelper
|
||||
|
||||
load_and_authorize_resource class: Version::ContactVersion
|
||||
|
||||
def index
|
||||
params[:q] ||= {}
|
||||
|
||||
search_params = PartialSearchFormatter.format(params[:q])
|
||||
search_params = PartialSearchFormatter.format(fix_date_params)
|
||||
versions = Version::ContactVersion.includes(:item).order(created_at: :desc, id: :desc)
|
||||
@q = versions.ransack(polymorphic_association(search_params))
|
||||
|
||||
|
@ -48,5 +48,14 @@ module Admin
|
|||
|
||||
record_type
|
||||
end
|
||||
|
||||
def fix_date_params
|
||||
params_copy = params[:q].deep_dup
|
||||
if params_copy['created_at_lteq'].present?
|
||||
params_copy['created_at_lteq'] = Date.parse(params_copy['created_at_lteq']) + 1.day
|
||||
end
|
||||
|
||||
params_copy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue