Class: Primrose::Components::Form
- Defined in:
- lib/primrose/components/form.rb
Constant Summary collapse
- TEMPLATE =
"<form class=\"<%= @style_class %>\" action=\"<%= @action %>\" method=\"<%= @method %>\">\n <%= @elements.join(\"\\n\") %>\n</form>\n"
Instance Attribute Summary
Attributes inherited from Rose
#children, #event_handlers, #state
Instance Method Summary collapse
-
#initialize(elements:, method:, style_class: nil, action: nil, **opts) ⇒ Form
constructor
A new instance of Form.
- #render ⇒ Object
Methods inherited from Rose
#add_child, #get_binding, #handle_error, #lifecycle, #on, #render_children, #trigger
Constructor Details
#initialize(elements:, method:, style_class: nil, action: nil, **opts) ⇒ Form
Returns a new instance of Form.
10 11 12 13 14 15 16 17 |
# File 'lib/primrose/components/form.rb', line 10 def initialize(elements:, method:, style_class: nil, action: nil, **opts) @elements = elements = opts @style_class = style_class @action = action @method = method super() end |
Instance Method Details
#render ⇒ Object
19 20 21 |
# File 'lib/primrose/components/form.rb', line 19 def render Prim.render(TEMPLATE, self) end |