Module: FeatureBox::ApplicationHelper

Includes:
Helpers
Defined in:
app/helpers/feature_box/application_helper.rb

Instance Method Summary collapse

Methods included from Helpers

define_helpers, included

Instance Method Details

#devise_error_messages!Object



25
26
27
# File 'app/helpers/feature_box/application_helper.rb', line 25

def devise_error_messages!
  resource.errors.full_messages.map { |msg| (:li, msg) }.join.html_safe
end

#devise_error_messages_any?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'app/helpers/feature_box/application_helper.rb', line 17

def devise_error_messages_any?
  if respond_to? :resource
    return !resource.errors.empty?
  else 
    return false
  end
end

#devise_router_nameObject



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