Sha256: c56b13694cf2ae2bfb1074e6410c035c646425d31010836fd7edecfb020c40c8

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

Contents

module Spina
  module Admin
    class AdminController < ApplicationController
      
      before_filter :authorize_user
      before_filter :new_messages

      layout 'spina/admin/application'

      private

      def authorize_user
        redirect_to spina.admin_login_url, flash: {information: "Je zult eerst moeten inloggen."} unless current_user
      end

      def new_messages
        @new_messages = Inquiry.new_messages.sorted
      end

      def current_account
        @current_account ||= Account.first
      end
      helper_method :current_account
      
      def current_user
        @current_user ||= User.where(id: session[:user_id]).first if session[:user_id]
      end
      helper_method :current_user

      def current_ability
        @current_ability ||= Ability.new(current_user)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spina-0.6.12 app/controllers/spina/admin/admin_controller.rb
spina-0.6.11 app/controllers/spina/admin/admin_controller.rb