Class: Padrino::Helpers::FormBuilder::StandardFormBuilder
- Inherits:
-
AbstractFormBuilder
- Object
- AbstractFormBuilder
- Padrino::Helpers::FormBuilder::StandardFormBuilder
- Defined in:
- padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb
Instance Attribute Summary
Attributes inherited from AbstractFormBuilder
#attributes_name, #is_nested, #model_name, #multipart, #namespace, #nested_index, #object, #parent_form, #template
Instance Method Summary collapse
-
#field_type ⇒ Object
StandardFormBuilder.
- #image_submit_block(source, options = {}) ⇒ Object
- #submit_block(caption, options = {}) ⇒ Object
Methods inherited from AbstractFormBuilder
#check_box, #check_box_group, #color_field, #csrf_token_field, #date_field, #datetime_field, #datetime_local_field, #email_field, #error_message_on, #error_messages, #fields_for, #file_field, #hidden_field, #image_submit, #initialize, #label, #month_field, #number_field, #password_field, #radio_button, #radio_button_group, #search_field, #select, #submit, #telephone_field, #text_area, #text_field, #time_field, #url_field, #week_field
Constructor Details
This class inherits a constructor from Padrino::Helpers::FormBuilder::AbstractFormBuilder
Instance Method Details
#field_type ⇒ Object
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'])
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 17 (self.field_types - [ :hidden_field, :radio_button ]).each do |field_type| class_eval <<-EOF def #{field_type}_block(field, options={}, label_options={}) if options[:caption] options = options.dup label_options = { :caption => options.delete(:caption) }.update(label_options) end 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
36 37 38 39 |
# File 'padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 36 def image_submit_block(source, ={}) submit_html = self.image_submit(source, ) @template.content_tag(:p, submit_html) end |
#submit_block(caption, options = {}) ⇒ Object
31 32 33 34 |
# File 'padrino-helpers/lib/padrino-helpers/form_builder/standard_form_builder.rb', line 31 def submit_block(, ={}) submit_html = self.submit(, ) @template.content_tag(:p, submit_html) end |