Sha256: c640b63c48694f98034dfb0c5382af85fc117f483c8a7b83918397dddd0074f0

Contents?: true

Size: 1.53 KB

Versions: 19

Compression:

Stored size: 1.53 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
      if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
        @datatable = Effective::Datatables::Logs.new()
      else
        @datatable = EffectiveLogsDatatable.new(self)
      end

      @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?
        if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
          @log.datatable = Effective::Datatables::Logs.new(log_id: @log.id)
        else
          @log.datatable = EffectiveLogsDatatable.new(self, log_id: @log.id)
        end
      end

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
effective_logging-1.11.5 app/controllers/admin/logs_controller.rb
effective_logging-1.11.4 app/controllers/admin/logs_controller.rb
effective_logging-1.11.3 app/controllers/admin/logs_controller.rb
effective_logging-1.11.2 app/controllers/admin/logs_controller.rb
effective_logging-1.11.1 app/controllers/admin/logs_controller.rb
effective_logging-1.11.0 app/controllers/admin/logs_controller.rb
effective_logging-1.10.18 app/controllers/admin/logs_controller.rb
effective_logging-1.10.17 app/controllers/admin/logs_controller.rb
effective_logging-1.10.16 app/controllers/admin/logs_controller.rb
effective_logging-1.10.15 app/controllers/admin/logs_controller.rb
effective_logging-1.10.14 app/controllers/admin/logs_controller.rb
effective_logging-1.10.13 app/controllers/admin/logs_controller.rb
effective_logging-1.10.12 app/controllers/admin/logs_controller.rb
effective_logging-1.10.11 app/controllers/admin/logs_controller.rb
effective_logging-1.10.10 app/controllers/admin/logs_controller.rb
effective_logging-1.10.9 app/controllers/admin/logs_controller.rb
effective_logging-1.10.8 app/controllers/admin/logs_controller.rb
effective_logging-1.10.7 app/controllers/admin/logs_controller.rb
effective_logging-1.10.6 app/controllers/admin/logs_controller.rb