Module: BootstrapHelpers::ViewHelpers
- Includes:
- FlashMessageProccessor, UrlProcessor
- Defined in:
- lib/bootstrap_helpers/view_helpers.rb
Instance Method Summary collapse
- #bootstrap_flash_messages(params = {}) ⇒ Object
- #bootstrap_form_actions(params = {}) ⇒ Object
- #bootstrap_form_for(form_object, legend = '', params = {}) ⇒ Object
- #bootstrap_form_input(title, params = {}) ⇒ Object
- #bootstrap_form_tag(path, legend = '', params = {}) ⇒ Object
- #bootstrap_navigation_item(title, url_value, params = {}) ⇒ Object
- #bootstrap_prepended_input(title, symbol, params = {}) ⇒ Object
Methods included from UrlProcessor
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 (params={}) params[:class]="bootstrap_flash_messages #{params[:class]}" content_tag :div, params do flash.each do |type, content| case content when Array concat flash_block_template(content, type) when String concat (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]}" content_tag :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(content_tag(:fieldset) do concat content_tag(: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]}" content_tag :div, params do concat content_tag(:label, title) concat content_tag(: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(content_tag(:fieldset) do concat content_tag(: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 (title, url_value, params={}) content_tag :li, :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 content_tag(:div, :class=>'input-prepend') do concat content_tag(:span, symbol, :class=>'add-on') concat yield end end end |