Module ApplicationHelper
In: app/helpers/application_helper.rb

Methods added to this helper will be available to all templates in the application.

Methods

Public Instance methods

[Source]

    # File app/helpers/application_helper.rb, line 18
18:   def current_location
19:     controller_title = replace_and_capitalize(controller.controller_name)
20:     action_title     = ['index'].include?(controller.action_name) ? '' : ' &laquo; ' << replace_and_capitalize(controller.action_name)
21:     return controller_title <<  action_title
22:   end

[Source]

    # File app/helpers/application_helper.rb, line 10
10:   def current_user
11:     session && session[:user_id] ? User.find_by_id(session[:user_id]) : nil
12:   end

[Source]

    # File app/helpers/application_helper.rb, line 14
14:   def is_authorized_as? role
15:     return Authorize.is_role_allowed_for_user?(current_user, role)
16:   end

[Source]

   # File app/helpers/application_helper.rb, line 4
4:   def javascript_include_google_analytics_tag
5:     if ['production'].include?(RAILS_ENV)
6:       return javascript_include_tag('google_analytics')
7:     end
8:   end

[Source]

    # File app/helpers/application_helper.rb, line 88
88:   def link_to_about
89:     link_to t('meta.about'), :controller => 'meta', :action => 'about'
90:   end

[Source]

    # File app/helpers/application_helper.rb, line 92
92:   def link_to_about_popup
93:     link_to_popup(t('meta.about'), 'about')
94:   end

[Source]

     # File app/helpers/application_helper.rb, line 125
125:   def link_to_blog_popup
126:     link_to(
127:          image_gif('blog',t('meta.blog')), 
128:          { 
129:            :action => 'parse_feed', 
130:            :controller => 'rss', 
131:            :rss_url => 'http://word.wardosworld.com/?feed=rss2&cat=6', 
132:            :maximum_number_of_items => 10, 
133:            :title => t('meta.blog'),
134:            :details => t('meta.blog_read_more'),
135:            :details_url => 'http://word.wardosworld.com/?cat=6'
136:          } , 
137:          :class => 'popup',
138:          :onclick => "return hs.htmlExpand(this, { objectType: 'ajax', contentId: 'popup', wrapperClassName: 'highslide-no-border', dimmingOpacity: 0.75, align: 'center'} )"
139:      ) 
140:   end

[Source]

    # File app/helpers/application_helper.rb, line 63
63:   def link_to_character_of_moment(character = nil)
64:     return link_to(character ? character.to_label : t('character_of_moment.title'), :action => 'character_of_moment', :controller => 'characters', :id => character.id)
65:   end

[Source]

    # File app/helpers/application_helper.rb, line 59
59:   def link_to_character_of_moment_popup(character = nil, html_options = nil)
60:     link_to_popup(character || t('character_of_moment.title'), 'character_of_moment', html_options)
61:   end

[Source]

    # File app/helpers/application_helper.rb, line 67
67:   def link_to_forgot_password
68:     return link_to(t('account.forgot_password'), :action => 'request_password_reset', :controller => 'accounts')
69:     link_to_popup( t('account.forgot_password'), 'accounts/reset_password' )
70:   end

[Source]

    # File app/helpers/application_helper.rb, line 47
47:   def link_to_login
48:     return link_to(t('account.login'), :action => 'login', :controller => 'accounts')
49:   end

[Source]

    # File app/helpers/application_helper.rb, line 37
37:   def link_to_login
38:     return link_to(t('actions.login'), :action => 'login', :controller => 'accounts')
39:     link_to_popup( t('actions.login'),'accounts/login' )
40:  end

[Source]

    # File app/helpers/application_helper.rb, line 29
29:   def link_to_my_study_lists
30:     link_to(t('activerecord.attributes.vocabulary_list.my_lists'), :controller => 'vocabulary_lists', :action => 'my_lists')
31:   end

[Source]

    # File app/helpers/application_helper.rb, line 76
76:   def link_to_privacy_policy
77:     link_to t('meta.privacy_policy'), :controller => 'meta', :action => 'privacy_policy'
78:   end

[Source]

     # File app/helpers/application_helper.rb, line 104
104:   def link_to_privacy_policy_popup
105:     link_to_popup(t('meta.privacy_policy'), 'privacy_policy')
106:   end

[Source]

    # File app/helpers/application_helper.rb, line 42
42:   def link_to_register
43:     return link_to(t('account.create.title'), :action => 'register', :controller => 'accounts')
44:     link_to_popup( t('account.create.title'), 'accounts/register' )
45:   end

[Source]

    # File app/helpers/application_helper.rb, line 84
84:   def link_to_supporting
85:     link_to t('meta.supporting'), :controller => 'meta', :action => 'support'
86:   end

[Source]

    # File app/helpers/application_helper.rb, line 96
96:   def link_to_supporting_popup
97:     link_to_popup(t('meta.support'), 'support')
98:   end

[Source]

    # File app/helpers/application_helper.rb, line 80
80:   def link_to_terms_of_service
81:     link_to t('meta.terms_of_service'), :controller => 'meta', :action => 'terms_of_service'
82:   end

[Source]

     # File app/helpers/application_helper.rb, line 100
100:   def link_to_terms_of_service_popup
101:     link_to_popup(t('meta.terms_of_service'), 'terms_of_service')
102:   end

[Source]

     # File app/helpers/application_helper.rb, line 108
108:   def link_to_twitter_popup
109:     link_to(
110:          image_gif('twitter',t('meta.twitter')), 
111:          { 
112:            :action => 'parse_feed', 
113:            :controller => 'rss', 
114:            :rss_url => 'http://twitter.com/statuses/user_timeline/22415532.rss', 
115:            :maximum_number_of_items => 10, 
116:            :title => t('meta.twitter'),
117:            :details => t('meta.twitter_read_more'),
118:            :details_url => 'http://twitter.com/kotoba_app'
119:          } , 
120:          :class => 'popup',
121:          :onclick => "return hs.htmlExpand(this, { objectType: 'ajax', contentId: 'popup', wrapperClassName: 'highslide-no-border', dimmingOpacity: 0.75, align: 'center'} )"
122:      ) 
123:   end

[Source]

    # File app/helpers/application_helper.rb, line 33
33:   def link_to_user_name_at_stock_kanji
34:     link_to(t('external.stockkanji.user_name_in_kana', :first_name => current_user.first_name),"http://www.stockkanji.com/advanced_search_result.php?search_from_box=1&csearch=1&inc_subcat=1&keywords=#{h(current_user.first_name)}")
35:   end

[Source]

    # File app/helpers/application_helper.rb, line 55
55:   def link_to_word_of_moment
56:     return link_to(t('word_of_moment.title'), :action => 'word_of_moment', :controller => 'words')
57:   end

[Source]

    # File app/helpers/application_helper.rb, line 51
51:   def link_to_word_of_moment_popup(word = nil, html_options = nil)
52:     link_to_popup(t(word || 'word_of_moment.title'), 'word_of_moment', html_options)
53:   end

[Source]

    # File app/helpers/application_helper.rb, line 72
72:   def mail_to_webmaster(text = t('system.general.contact_webmaster.title'))
73:     return mail_to(t('system.general.contact_webmaster.email'), text, :subject => t('system.general.contact_webmaster.subject'))
74:   end

[Source]

    # File app/helpers/application_helper.rb, line 24
24:   def replace_and_capitalize(text, replace_character = '_', replace_with_character = ' ')
25:     cleaned_text = text.split(replace_character).map{ |word| word.capitalize }.join(replace_with_character)    
26:     return cleaned_text
27:   end

[Validate]