Sha256: 8924adf2500835e601e783d09070c4f0015b515d44b14ae2f94f25dafbd0b6d7

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

class BackendController < ActionController::Base
  include Udongo::Cryptography

  layout 'backend/application'
  before_action :check_login

  def breadcrumb
    @breadcrumb ||= Udongo::Breadcrumb.new
  end
  helper_method :breadcrumb

  def current_admin
    @current_admin ||= ::Admin.find(session[:admin_id]) if session[:admin_id]
  end
  helper_method :current_admin

  def translate_notice(notice, actor)
    I18n.t("b.msg.#{notice}") % I18n.t("b.#{actor}")
  end

  def default_locale
    Udongo.config.default_locale
  end
  helper_method :default_locale

  private

  def check_login
    unless current_admin
      session[:backend_redirect] = request.url
      redirect_to new_backend_session_path
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
udongo-1.0.3 app/controllers/backend_controller.rb
udongo-1.0.2 app/controllers/backend_controller.rb
udongo-1.0.1 app/controllers/backend_controller.rb
udongo-1.0.0 app/controllers/backend_controller.rb
udongo-0.1.0 app/controllers/backend_controller.rb