Sha256: 11eef06ba0af25061240ca0301a2a7577b3803681c3abeba486904d08518b9e1

Contents?: true

Size: 816 Bytes

Versions: 4

Compression:

Stored size: 816 Bytes

Contents

require 'spotlight'

module Spotlight::Concerns
  # Inherit from the host app's ApplicationController
  # This will configure e.g. the layout used by the host
  module ApplicationController
    extend ActiveSupport::Concern
    include Spotlight::Controller
    
    included do
      layout 'spotlight/spotlight'
      
      helper Spotlight::ApplicationHelper

      rescue_from CanCan::AccessDenied do |exception|
        if current_exhibit and !can? :read, current_exhibit
          # Try to authenticate the user
          authenticate_user!
  
          # If that fails (and we end up back here), offer a 404 error instead
          raise ActionController::RoutingError.new('Not Found')
        else
          redirect_to main_app.root_url, :alert => exception.message
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 app/controllers/spotlight/concerns/application_controller.rb
blacklight-spotlight-0.3.1 app/controllers/spotlight/concerns/application_controller.rb
blacklight-spotlight-0.3.0 app/controllers/spotlight/concerns/application_controller.rb
blacklight-spotlight-0.2.0 app/controllers/spotlight/concerns/application_controller.rb