Class: Primrose::Components::Form

Inherits:
Rose
  • Object
show all
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

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
  @options = opts
  @style_class = style_class
  @action = action
  @method = method
  super()
end

Instance Method Details

#renderObject



19
20
21
# File 'lib/primrose/components/form.rb', line 19

def render
  Prim.render(TEMPLATE, self)
end