Module: ZurbRush::ViewHelpers
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/zurb-rush/view_helpers.rb
Instance Method Summary collapse
-
#alert_box(content, *classes) ⇒ Object
Alert Boxes.
- #columns(columns, options = {}) ⇒ Object
- #display_flash_messages ⇒ Object
-
#foundation_form_for(record, options = {}, &proc) ⇒ Object
Forms.
-
#label_box(content, *classes) ⇒ Object
Labels.
-
#row(options = {}) ⇒ Object
The Grid.
Instance Method Details
#alert_box(content, *classes) ⇒ Object
Alert Boxes
40 41 42 43 44 |
# File 'lib/zurb-rush/view_helpers.rb', line 40 def alert_box(content, *classes) content_tag :div, :class => add_to_class("alert-box", *classes) do raw(content + content_tag(:a, '×', {:href => '#', :class => 'close'}, false)) end end |
#columns(columns, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/zurb-rush/view_helpers.rb', line 19 def columns(columns, = {}) classes = ['columns'] columns = columns.humanize if columns.respond_to?(:humanize) classes << columns if [:mobile] mobile_cols = .delete(:mobile) mobile_cols = mobile_cols.humanize if mobile_cols.respond_to?(:humanize) classes << "mobile-#{mobile_cols}" end [:class] = add_to_class([:class], *classes) content_tag :div, do yield end end |
#display_flash_messages ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/zurb-rush/view_helpers.rb', line 46 def flash.inject "" do |, (key, value)| # Change to match up to Rails' flash expectations. key = "success" if key.to_s == "notice" += alert_box(value, key) end.html_safe end |
#foundation_form_for(record, options = {}, &proc) ⇒ Object
Forms
62 63 64 65 |
# File 'lib/zurb-rush/view_helpers.rb', line 62 def foundation_form_for(record, = {}, &proc) defaults = {:builder => ZurbRush::FormBuilder} form_for(record, defaults.merge(), &proc) end |
#label_box(content, *classes) ⇒ Object
Labels
56 57 58 |
# File 'lib/zurb-rush/view_helpers.rb', line 56 def label_box(content, *classes) content_tag :span, content, :class => add_to_class("label", *classes) end |
#row(options = {}) ⇒ Object
The Grid
11 12 13 14 15 16 17 |
# File 'lib/zurb-rush/view_helpers.rb', line 11 def row( = {}) [:class] = add_to_class([:class], 'row') content_tag :div, do yield end end |