mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
23 lines
618 B
Ruby
23 lines
618 B
Ruby
class Admin::ReppLogsController < AdminController
|
|
load_and_authorize_resource class: ApiLog::ReppLog
|
|
before_action :set_default_dates, only: [:index]
|
|
|
|
def index
|
|
@q = ApiLog::ReppLog.search(params[:q])
|
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
|
@repp_logs = @q.result.page(params[:page])
|
|
end
|
|
|
|
def show
|
|
@repp_log = ApiLog::ReppLog.find(params[:id])
|
|
end
|
|
|
|
def set_default_dates
|
|
params[:q] ||= {}
|
|
|
|
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:clear_fields].nil?
|
|
params[:q][:created_at_gteq] = Time.now.strftime("%Y-%m-%d")
|
|
end
|
|
|
|
end
|
|
end
|