Class: Admin::LogsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



10
11
12
13
14
15
# File 'app/controllers/admin/logs_controller.rb', line 10

def index
  @datatable = Effective::Datatables::Logs.new() if defined?(EffectiveDatatables)
  @page_title = 'Logs'

  EffectiveLogging.authorized?(self, :index, Effective::Log)
end

#showObject



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

def show
  @log = Effective::Log.includes(:logs).find(params[:id])
  @log.next_log = Effective::Log.unscoped.order(:id).where(:parent_id => @log.parent_id).where('id > ?', @log.id).first
  @log.prev_log = Effective::Log.unscoped.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 = Effective::Datatables::Logs.new(:log_id => @log.id) if defined?(EffectiveDatatables)
  end

  EffectiveLogging.authorized?(self, :show, @log)
end