Module: FeatureBox::ApplicationHelper
- Includes:
- Helpers
- Defined in:
- app/helpers/feature_box/application_helper.rb
Instance Method Summary collapse
- #devise_error_messages! ⇒ Object
- #devise_error_messages_any? ⇒ Boolean
- #devise_router_name ⇒ Object
- #generate_form_element(form, name, element) ⇒ Object
- #multiline(text) ⇒ Object
Methods included from Helpers
Instance Method Details
#devise_error_messages! ⇒ Object
25 26 27 |
# File 'app/helpers/feature_box/application_helper.rb', line 25 def resource.errors..map { |msg| content_tag(:li, msg) }.join.html_safe end |
#devise_error_messages_any? ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'app/helpers/feature_box/application_helper.rb', line 17 def if respond_to? :resource return !resource.errors.empty? else return false end end |
#devise_router_name ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/helpers/feature_box/application_helper.rb', line 29 def devise_router_name if controller.class.name =~ /FeatureBox::Devise/ feature_box else self end end |
#generate_form_element(form, name, element) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/feature_box/application_helper.rb', line 4 def generate_form_element form, name, element if name == nil then raw '<div class="control-group"><div class="controls">'+element+'</div></div>' else raw '<div class="control-group">'+form.label(name, :class=>"control-label")+'<div class="controls">'+element+'</div></div>' end end |
#multiline(text) ⇒ Object
12 13 14 |
# File 'app/helpers/feature_box/application_helper.rb', line 12 def multiline text raw h(text).gsub(/\n/, '<br/>') end |