Class: ApplicationController
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
#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_available ⇒ Object
49
50
51
52
53
54
55
|
# File 'app/controllers/application.rb', line 49
def check_desired_login_available
if current_user.nil?
desired_login = params[:desired_login] || flash[:desired_login]
@login_not_available = ! User.find_by_login(desired_login).nil?
end
true
end
|
#drop_top_crumbs ⇒ Object
57
58
59
|
# File 'app/controllers/application.rb', line 57
def drop_top_crumbs
@crumbs = [{ 'Home'.t => {:controller => 'root', :action => 'index'} }]
end
|
#set_locale ⇒ Object
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_renderer ⇒ Object
45
46
47
|
# File 'app/controllers/application.rb', line 45
def setup_renderer
@renderer = create_renderer
end
|