Sha256: cb119765922bc585e5b6b6189dafccea9350fef34a2d080070ada02f0e1c97b2

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Admin
  class LogsController < ApplicationController
    respond_to?(:before_action) ? before_action(:authenticate_user!) : before_filter(:authenticate_user!) # Devise

    layout (EffectiveLogging.layout.kind_of?(Hash) ? EffectiveLogging.layout[:admin_logs] : EffectiveLogging.layout)

    skip_log_page_views :quiet => true
    helper EffectiveLoggingHelper

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

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

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_logging-1.5.9 app/controllers/admin/logs_controller.rb
effective_logging-1.5.8 app/controllers/admin/logs_controller.rb
effective_logging-1.5.7 app/controllers/admin/logs_controller.rb