Class: Tennpipes::Helpers::FormBuilder::StandardFormBuilder
- Inherits:
-
AbstractFormBuilder
- Object
- AbstractFormBuilder
- Tennpipes::Helpers::FormBuilder::StandardFormBuilder
- Defined in:
- lib/tennpipes-helper/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, #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 Tennpipes::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 |
# File 'lib/tennpipes-helper/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={}) 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
33 34 35 36 |
# File 'lib/tennpipes-helper/form_builder/standard_form_builder.rb', line 33 def image_submit_block(source, ={}) submit_html = self.image_submit(source, ) @template.content_tag(:p, submit_html) end |
#submit_block(caption, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/tennpipes-helper/form_builder/standard_form_builder.rb', line 28 def submit_block(caption, ={}) submit_html = self.submit(caption, ) @template.content_tag(:p, submit_html) end |