Module: AbstractInterface::FormBuilders::AbstractFormBuilder
- Included in:
- ThemedFormBuilder, ThemedFormTagBuilder
- Defined in:
- lib/abstract_interface/form_builders/abstract_form_builder.rb
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #error_messages(*errors) ⇒ Object
- #field_tag(html, options = {}) ⇒ Object
- #line(*items) ⇒ Object
-
#line_with_delimiters(*items) ⇒ Object
def hidden_field_tag *args result << @template.hidden_field_tag(*args) end.
-
#method_missing(name, *args, &block) ⇒ Object
text_field_tag, …
- #submit(*args) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
text_field_tag, … xxx_tag
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 24 def method_missing name, *args, &block = args..symbolize_keys args << inject_styles! , name input = @template.send name, *args, &block remove_styles! custom_helper input, , name, [:object], *args end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
5 6 7 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 5 def template @template end |
Instance Method Details
#error_messages(*errors) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 37 def *errors if errors.size == 1 and errors.first.is_a?(Array) *errors else errors end end |
#field_tag(html, options = {}) ⇒ Object
45 46 47 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 45 def field_tag html, = {} custom_helper html, , nil, [:object] end |
#line(*items) ⇒ Object
7 8 9 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 7 def line *items template.render :partial => template.themed_partial('forms/line'), :object => {:items => items, :delimiter => false}.to_openobject end |
#line_with_delimiters(*items) ⇒ Object
def hidden_field_tag *args
result[:hidden_fields] << @template.hidden_field_tag(*args)
end
19 20 21 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 19 def line_with_delimiters *items template.render :partial => template.themed_partial('forms/line'), :object => {:items => items, :delimiter => true}.to_openobject end |
#submit(*args) ⇒ Object
11 12 13 |
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 11 def submit *args @template.submit_tag *args end |