Sha256: 428cce6143156e54fe1f5bdc78dab0fa1c170bf30c8cc52c285d670fde8b834a

Contents?: true

Size: 707 Bytes

Versions: 7

Compression:

Stored size: 707 Bytes

Contents

class Admin::BaseController < ActionController::Base

  include Typus::Authentication::const_get(Typus.authentication.to_s.classify)

  before_filter :reload_config_and_roles
  before_filter :authenticate
  before_filter :set_locale

  helper_method :admin_user
  helper_method :current_role

  protected

  def reload_config_and_roles
    Typus.reload! if Rails.env.development?
  end

  def set_locale
    I18n.locale = if admin_user && admin_user.respond_to?(:locale)
      admin_user.locale
    else
      Typus::I18n.default_locale
    end
  end

  def zero_users
    Typus.user_class.count.zero?
  end

  def not_allowed
    render :text => "Not allowed!", :status => :unprocessable_entity
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typus-3.1.7 app/controllers/admin/base_controller.rb
typus-3.1.6 app/controllers/admin/base_controller.rb
typus-3.1.5 app/controllers/admin/base_controller.rb
typus-3.1.4 app/controllers/admin/base_controller.rb
typus-3.1.3 app/controllers/admin/base_controller.rb
typus-3.1.2 app/controllers/admin/base_controller.rb
typus-3.1.1 app/controllers/admin/base_controller.rb