Class: HomeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/home_controller.rb

Overview

Copyright © 2010-2012, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Method Summary collapse

Instance Method Details

#force_mobileObject


41
42
43
44
45
# File 'app/controllers/home_controller.rb', line 41

def force_mobile
  session[:mobile_view] = true

  redirect_to stream_path
end

#podminObject


31
32
33
# File 'app/controllers/home_controller.rb', line 31

def podmin
  render :podmin
end

#showObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/home_controller.rb', line 8

def show
  partial_dir = Rails.root.join("app", "views", "home")
  if user_signed_in?
    redirect_to stream_path
  elsif request.format == :mobile
    if partial_dir.join("_show.mobile.haml").exist? ||
       partial_dir.join("_show.mobile.erb").exist? ||
       partial_dir.join("_show.haml").exist?
      render :show
    else
      redirect_to user_session_path
    end
  elsif partial_dir.join("_show.html.haml").exist? ||
        partial_dir.join("_show.html.erb").exist? ||
        partial_dir.join("_show.haml").exist?
    render :show
  elsif Role.admins.any?
    render :default
  else
    redirect_to podmin_path
  end
end

#toggle_mobileObject


35
36
37
38
39
# File 'app/controllers/home_controller.rb', line 35

def toggle_mobile
  session[:mobile_view] = session[:mobile_view].nil? ? true : !session[:mobile_view]

  redirect_back fallback_location: root_path
end