Module: ZurbRush::ViewHelpers

Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/zurb-rush/view_helpers.rb

Instance Method Summary collapse

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)
   :div, :class => add_to_class("alert-box", *classes) do
    raw(content + (: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, options = {})
  classes = ['columns']

  columns = columns.humanize if columns.respond_to?(:humanize)
  classes << columns

  if options[:mobile]
    mobile_cols = options.delete(:mobile)
    mobile_cols = mobile_cols.humanize if mobile_cols.respond_to?(:humanize)
    classes << "mobile-#{mobile_cols}"
  end

  options[:class] = add_to_class(options[:class], *classes)

   :div, options do
    yield
  end
end

#display_flash_messagesObject



46
47
48
49
50
51
52
# File 'lib/zurb-rush/view_helpers.rb', line 46

def display_flash_messages
  flash.inject "" do |message, (key, value)|
    # Change to match up to Rails' flash expectations.
    key = "success" if key.to_s == "notice"
    message += 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, options = {}, &proc)
  defaults = {:builder => ZurbRush::FormBuilder}
  form_for(record, defaults.merge(options), &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)
   :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(options = {})
  options[:class] = add_to_class(options[:class], 'row')

   :div, options do
    yield
  end
end