Class: WelcomeController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_breadcrumb, #after_sign_in_path_for, #breadcrumbs, #new_session_path, #require_admin_user

Instance Method Details

#helpObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/welcome_controller.rb', line 14

def help
  # Piggybacking on this page to pass custom HTTP headers to Mediaflux
  # in a very controlled scenario.
  root_ns = Rails.configuration.mediaflux["api_root_collection_namespace"]
  parent_collection = Rails.configuration.mediaflux["api_root_collection_name"]
  @test_path = Pathname.new(root_ns).join(parent_collection)
  @test_http_headers = false
  unless current_user.nil?
    @test_http_headers = params["http-headers"] == "true"
    request = if @test_http_headers
                Mediaflux::AssetExistRequest.new(session_token: current_user.mediaflux_session, path: @test_path, session_user: current_user)
              else
                Mediaflux::AssetExistRequest.new(session_token: current_user.mediaflux_session, path: @test_path)
              end
    @test_path_exist = request.exist?
  end
end

#indexObject



6
7
8
9
10
11
12
# File 'app/controllers/welcome_controller.rb', line 6

def index
  if current_user.blank?
    render layout: "welcome"
  else
    redirect_to dashboard_path
  end
end