Class: Padrino::Helpers::FormBuilder::StandardFormBuilder

Inherits:
AbstractFormBuilder show all
Defined in:
lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/form_builder/standard_form_builder.rb

Instance Attribute Summary

Attributes inherited from AbstractFormBuilder

#object, #template

Instance Method Summary collapse

Methods inherited from AbstractFormBuilder

#check_box, #check_box_group, #csrf_token_field, #email_field, #error_message_on, #error_messages, #fields_for, #file_field, #hidden_field, #image_submit, #initialize, #label, #number_field, #password_field, #radio_button, #radio_button_group, #search_field, #select, #submit, #telephone_field, #text_area, #text_field, #url_field

Constructor Details

This class inherits a constructor from Padrino::Helpers::FormBuilder::AbstractFormBuilder

Instance Method Details

#field_typeObject

StandardFormBuilder

text_field_block(:username, { :class => 'long' }, { :class => 'wide-label' })
text_area_block(:summary, { :class => 'long' }, { :class => 'wide-label' })
password_field_block(:password, { :class => 'long' }, { :class => 'wide-label' })
file_field_block(:photo, { :class => 'long' }, { :class => 'wide-label' })
check_box_block(:remember_me, { :class => 'long' }, { :class => 'wide-label' })
select_block(:color, :options => ['green', 'black'])


18
19
20
21
22
23
24
25
26
27
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 18

(self.field_types - [ :hidden_field, :radio_button ]).each do |field_type|
  class_eval <<-EOF
  def #{field_type}_block(field, options={}, label_options={})
    label_options.reverse_merge!(:caption => options.delete(:caption)) if options[:caption]
    field_html = label(field, label_options)
    field_html << #{field_type}(field, options)
    @template.content_tag(:p, field_html)
  end
  EOF
end

#image_submit_block(source, options = {}) ⇒ Object

image_submit_block(“submit.png”)



36
37
38
39
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 36

def image_submit_block(source, options={})
  submit_html = self.image_submit(source, options)
  @template.(:p, submit_html)
end

#submit_block(caption, options = {}) ⇒ Object

submit_block(“Update”)



30
31
32
33
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 30

def submit_block(caption, options={})
  submit_html = self.submit(caption, options)
  @template.(:p, submit_html)
end