Sha256: 527c0cdb1900fc2dfbaedf75bbebfbc0e1652b752fc2c7b059c9b5bdc3d75654

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 Bytes

Contents

module Brightcontent
  class ApplicationController < ActionController::Base
    add_flash_types :success, :info, :warning, :danger
    before_filter :authorize
    before_filter :set_locale
    helper TranslationHelper

    def index
      redirect_to root_path + user_resources.first.path
    end

    private

    def set_locale
      I18n.locale = Brightcontent.locale
    end

    def current_user
      @current_user ||= Brightcontent.user_model.find(session[:brightcontent_user_id]) if session[:brightcontent_user_id]
    end
    helper_method :current_user

    def user_resources
      @user_resources ||= RoutesParser.new.resources
    end
    helper_method :user_resources

    def authorize
      redirect_to login_url unless current_user
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
brightcontent-core-2.2.1 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.2.0 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.1.5 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.1.4 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.1.3 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.1.2 app/controllers/brightcontent/application_controller.rb
brightcontent-core-2.1.1 app/controllers/brightcontent/application_controller.rb