Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
ApplicationHelper, LoginSystem
Defined in:
app/controllers/application.rb

Overview

Filters added to this controller will be run for all controllers in the application. Likewise, all the methods added will be available for all controllers.

Instance Method Summary collapse

Methods included from ApplicationHelper

#current_locale, #current_user, #dynjs_include_tag, #pagetext, #parsing_error_box, #render_diff_table, #render_wiki, #server_url_for

Instance Method Details

#check_desired_login_availableObject



49
50
51
52
53
54
55
# File 'app/controllers/application.rb', line 49

def 
  if current_user.nil?
     = params[:desired_login] || flash[:desired_login]
    @login_not_available = ! User.().nil?
  end
  true
end

#drop_top_crumbsObject



57
58
59
# File 'app/controllers/application.rb', line 57

def drop_top_crumbs
  @crumbs = [{ 'Home'.t => {:controller => 'root', :action => 'index'} }]
end

#set_localeObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/application.rb', line 29

def set_locale
  default_locale = 'en-US'
  request_language = request.env['HTTP_ACCEPT_LANGUAGE']
  request_language = request_language.nil? ? nil : request_language[/[^,;]+/]

  @locale = params[:locale] || session[:locale] ||
            request_language || default_locale
  session[:locale] = @locale
  begin
    Locale.set @locale
  rescue
    @locale = default_locale
    Locale.set @locale
  end
end

#setup_rendererObject



45
46
47
# File 'app/controllers/application.rb', line 45

def setup_renderer
  @renderer = create_renderer
end