Sha256: ad111af64ab020e5f243541db969ec719f1accf24e19210af9b14e655fbebd29

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 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 = nil)
    Udongo::Notification.new(notice).translate(actor)
  end

  def default_locale
    Udongo.config.i18n.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-2.0.4 app/controllers/backend_controller.rb
udongo-2.0.3 app/controllers/backend_controller.rb
udongo-2.0.2 app/controllers/backend_controller.rb
udongo-2.0.1 app/controllers/backend_controller.rb
udongo-2.0.0 app/controllers/backend_controller.rb