Class: GOVUKDesignSystemFormBuilder::Elements::Submit
- Includes:
- Traits::HTMLAttributes
- Defined in:
- lib/govuk_design_system_formbuilder/elements/submit.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, text, warning:, secondary:, classes:, prevent_double_click:, validate:, disabled:, **kwargs, &block) ⇒ Submit
constructor
A new instance of Submit.
Methods included from Traits::HTMLAttributes
Methods inherited from Base
Constructor Details
#initialize(builder, text, warning:, secondary:, classes:, prevent_double_click:, validate:, disabled:, **kwargs, &block) ⇒ Submit
Returns a new instance of Submit.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/govuk_design_system_formbuilder/elements/submit.rb', line 7 def initialize(builder, text, warning:, secondary:, classes:, prevent_double_click:, validate:, disabled:, **kwargs, &block) super(builder, nil, nil) fail ArgumentError, 'buttons can be warning or secondary' if warning && secondary @text = build_text(text) @prevent_double_click = prevent_double_click @warning = warning @secondary = secondary @classes = classes @validate = validate @disabled = disabled @html_attributes = kwargs @block_content = capture { block.call } if block_given? end |
Instance Method Details
#html ⇒ Object
23 24 25 |
# File 'lib/govuk_design_system_formbuilder/elements/submit.rb', line 23 def html @block_content.present? ? : submit end |