Module: ActionForm::Rails::Rendering
- Included in:
- Base
- Defined in:
- lib/action_form/rails/rendering.rb
Overview
Rendering module for ActionForm Rails integration that provides form rendering functionality. Handles rendering of forms with error messages, authenticity tokens, UTF-8 encoding, and other Rails-specific form requirements. Also provides helper methods for rendering submit buttons and form elements.
Instance Method Summary collapse
- #render_authenticity_token ⇒ Object
- #render_form(&block) ⇒ Object
- #render_method_input ⇒ Object
- #render_submit(**html_attributes) ⇒ Object
- #render_utf8_input ⇒ Object
Instance Method Details
#render_authenticity_token ⇒ Object
19 20 21 |
# File 'lib/action_form/rails/rendering.rb', line 19 def render_authenticity_token input(name: "authenticity_token", type: "hidden", value: helpers.form_authenticity_token) end |
#render_form(&block) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/action_form/rails/rendering.rb', line 10 def render_form(&block) form(**{ method: html_method, action: html_action, "accept-charset" => "UTF-8" }, **@html_options) do render_utf8_input render_authenticity_token render_method_input yield if block end end |
#render_method_input ⇒ Object
23 24 25 |
# File 'lib/action_form/rails/rendering.rb', line 23 def render_method_input input(name: "_method", type: "hidden", value: http_method, autocomplete: "off") end |
#render_submit(**html_attributes) ⇒ Object
31 32 33 |
# File 'lib/action_form/rails/rendering.rb', line 31 def render_submit(**html_attributes) input(name: "commit", type: "submit", value: submit_value, **html_attributes) end |
#render_utf8_input ⇒ Object
27 28 29 |
# File 'lib/action_form/rails/rendering.rb', line 27 def render_utf8_input input(name: "utf8", type: "hidden", value: "✓", autocomplete: "off") end |