Module: BootstrapHelpers::ViewHelpers

Includes:
FlashMessageProccessor, UrlProcessor
Defined in:
lib/bootstrap_helpers/view_helpers.rb

Instance Method Summary collapse

Methods included from UrlProcessor

#navigation_item_class

Instance Method Details

#bootstrap_flash_messages(params = {}) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/bootstrap_helpers/view_helpers.rb', line 52

def bootstrap_flash_messages(params={})
  params[:class]="bootstrap_flash_messages #{params[:class]}"
   :div, params do
    flash.each do |type, content|
      case content
      when Array
        concat flash_block_template(content, type)
      when String
        concat flash_message_template(content, type)
      end
    end
    flash.clear
  end
end

#bootstrap_form_actions(params = {}) ⇒ Object



45
46
47
48
49
50
# File 'lib/bootstrap_helpers/view_helpers.rb', line 45

def bootstrap_form_actions(params={})
  params[:class]="actions #{params[:class]}"
   :div, params do
    yield
  end
end

#bootstrap_form_for(form_object, legend = '', params = {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/bootstrap_helpers/view_helpers.rb', line 19

def bootstrap_form_for(form_object, legend='', params={})
  form_for form_object, params do |f|
    concat((:fieldset) do
      concat (:legend, legend)
      yield(f)
    end)
  end
end

#bootstrap_form_input(title, params = {}) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/bootstrap_helpers/view_helpers.rb', line 28

def bootstrap_form_input(title, params={})
  params[:class]="clearfix #{params[:class]}"
   :div, params do
    concat (:label, title) 
    concat (:div, :class=>'input') { yield }
  end
end

#bootstrap_form_tag(path, legend = '', params = {}) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/bootstrap_helpers/view_helpers.rb', line 10

def bootstrap_form_tag(path,legend='',params={})
  form_tag path, params do
    concat((:fieldset) do
      concat (:legend, legend)
      yield
    end)
  end
end

#bootstrap_navigation_item(title, url_value, params = {}) ⇒ Object



67
68
69
70
71
# File 'lib/bootstrap_helpers/view_helpers.rb', line 67

def bootstrap_navigation_item(title, url_value, params={})
   :li, :class=>navigation_item_class(url_value) do
    link_to title, url_value, params
  end
end

#bootstrap_prepended_input(title, symbol, params = {}) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/bootstrap_helpers/view_helpers.rb', line 36

def bootstrap_prepended_input(title, symbol, params={})
  bootstrap_form_input(title, params) do
    (:div, :class=>'input-prepend') do
      concat (:span, symbol, :class=>'add-on') 
      concat yield
    end
  end
end