Sha256: 374565307c9b8dbc57949ac0fbeccb5d4009a5dcabd879a3236896f119c9ff23

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 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()
      @page_title = 'Logs'

      EffectiveLogging.authorized?(self, :index, Effective::Log)
      EffectiveLogging.authorized?(self, :admin, :effective_logging)
    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)
      EffectiveLogging.authorized?(self, :admin, :effective_logging)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_logging-1.10.2 app/controllers/admin/logs_controller.rb
effective_logging-1.10.1 app/controllers/admin/logs_controller.rb
effective_logging-1.10.0 app/controllers/admin/logs_controller.rb
effective_logging-1.9.0 app/controllers/admin/logs_controller.rb
effective_logging-1.8.1 app/controllers/admin/logs_controller.rb
effective_logging-1.8.0 app/controllers/admin/logs_controller.rb
effective_logging-1.7.1 app/controllers/admin/logs_controller.rb
effective_logging-1.7.0 app/controllers/admin/logs_controller.rb