Sha256: 889849572179add6b26d462b9f6774f50813afedfc38f3ed4659e0be76c34d60

Contents?: true

Size: 1.05 KB

Versions: 26

Compression:

Stored size: 1.05 KB

Contents

module Admin
  class LogsController < ApplicationController
    before_action :authenticate_user!
    skip_log_page_views

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

    def index
      @datatable = EffectiveLogsDatatable.new(self)

      @page_title = 'Logs'

      EffectiveLogging.authorize!(self, :index, Effective::Log)
      EffectiveLogging.authorize!(self, :admin, :effective_logging)
    end

    def show
      @log = Effective::Log.includes(:logs).find(params[:id])
      @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

      EffectiveLogging.authorize!(self, :show, @log)
      EffectiveLogging.authorize!(self, :admin, :effective_logging)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
effective_logging-2.0.5 app/controllers/admin/logs_controller.rb
effective_logging-2.0.4 app/controllers/admin/logs_controller.rb
effective_logging-2.0.3 app/controllers/admin/logs_controller.rb
effective_logging-2.0.2 app/controllers/admin/logs_controller.rb
effective_logging-2.0.1 app/controllers/admin/logs_controller.rb
effective_logging-2.0.0 app/controllers/admin/logs_controller.rb