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