summaryrefslogtreecommitdiff
path: root/app/controllers/page_controller.rb
blob: dc5f57b2a4b31271ae3ff06371f86be3e73c52fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class PageController < ApplicationController
  # load_and_authorize_resource :class => false  
  # CanCan doesn't work here really good because Page is not a resource.

  before_filter :if_fresh_system_then_go_to_wizard
  skip_before_filter :home_breadcrumb, :only => [:index]
  
  def index
    if current_user
      redirect_to [current_user.current_tenant, current_user]
    end
  end

  def conference;end
  def beginners_intro;end
  
  private
  def if_fresh_system_then_go_to_wizard
    if Tenant.count == 0 && User.count == 0
      # This is a brand new system. We need to run a setup first.
      redirect_to wizards_new_initial_setup_path
    else
      if current_user.nil?
        # You need to login first.
        redirect_to log_in_path, :alert => I18n.t('pages.controller.access_denied_login_first')
      end
    end
  end

end