Module: BootyboxFormHelper

Defined in:
app/helpers/bootybox_form_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_group_container(form, method, options = {}, &block) ⇒ Object



23
24
25
26
27
# File 'app/helpers/bootybox_form_helper.rb', line 23

def form_group_container(form, method, options = {}, &block)
  render "/bootybox/forms/form_group_container", :form => form, :method => method,
  :id => options[:id].to_s, :css_class => options[:class], :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
  :content => capture(&block)
end

#form_input_field(form, method, options = {}) ⇒ Object

TODO: Convert this into a form helper that works with form_for etc…



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/bootybox_form_helper.rb', line 6

def form_input_field(form, method, options = {})

  if options[:validation].blank?
    options[:validation] = []
  end

  options[:type] ||= :text_field

  render :partial => "/bootybox/forms/form_group_input", :locals => {
    :form => form, :method => method,
    :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
    :value => (options[:value] || (form.object.send(method) rescue nil) ),
    :validation => options[:validation], :title => options[:title], :type => options[:type],
    :tooltip => options[:tooltip]
  }
end

#form_select_field(form, method, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'app/helpers/bootybox_form_helper.rb', line 29

def form_select_field(form, method, options = {})

  options[:collection] ||= []

  render :partial => "/bootybox/forms/form_group_select", :locals => {
    :form => form, :method => method, :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
    :value => options[:value], :title => options[:title], :collection => options[:collection]
  }
end