Class: Admin::LogsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Effective::CrudController
Defined in:
app/controllers/admin/logs_controller.rb

Instance Method Summary collapse

Instance Method Details

#index ⇒ Object



13
14
15
16
17
# File 'app/controllers/admin/logs_controller.rb', line 13

def index
  EffectiveResources.authorize!(self, :index, Effective::Log)
  @datatable = EffectiveLogsDatatable.new(self)
  @page_title = 'Logs'
end

#show ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/admin/logs_controller.rb', line 19

def show
  @log = Effective::Log.includes(:logs).find(params[:id])
  EffectiveResources.authorize!(self, :show, @log)

  @log.next_log = Effective::Log.order(:id).where(parent_id: @log.parent_id).where('id > ?', @log.id).first
  @log.prev_log = Effective::Log.order(:id).where(parent_id: @log.parent_id).where('id < ?', @log.id).last

  @page_title = "Log ##{@log.to_param}"

  if @log.logs.present?
    @log.datatable = EffectiveLogsDatatable.new(self, log_id: @log.id)
  end

end