Class: CCS::Components::GovUK::Field::Inputs::Item::Radio::Form
- Inherits:
-
CCS::Components::GovUK::Field::Inputs::Item::Radio
- Object
- Base
- CCS::Components::GovUK::Field::Inputs::Item
- CCS::Components::GovUK::Field::Inputs::Item::Radio
- CCS::Components::GovUK::Field::Inputs::Item::Radio::Form
- Defined in:
- lib/ccs/components/govuk/field/inputs/item/radio/form.rb
Overview
GOV.UK Field Inputs Radio form tag
This is used to generate an individual radio item using form.check_box
Constant Summary
Constants inherited from CCS::Components::GovUK::Field::Inputs::Item::Radio
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(attribute:, label:, **options) ⇒ Form
constructor
A new instance of Form.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the radio input.
Constructor Details
#initialize(attribute:, label:, **options) ⇒ Form
Returns a new instance of Form.
19 20 21 22 23 24 25 26 |
# File 'lib/ccs/components/govuk/field/inputs/item/radio/form.rb', line 19 def initialize(attribute:, label:, **) super (label[:attributes] ||= {})[:value] = @value label[:attributes][:for] = @options[:attributes][:id] if @options[:attributes][:id] @label = Label.new(attribute: attribute, form: @options[:form], context: @context, **label) end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the radio input
32 33 34 35 36 |
# File 'lib/ccs/components/govuk/field/inputs/item/radio/form.rb', line 32 def render super do @options[:form].(@attribute, @value, **@options[:attributes]) end end |