Sha256: 037d819d32d4227e7e8e8a35d9fc95d6649e680255cbe9666fa582e1dcf62d9a

Contents?: true

Size: 1.26 KB

Versions: 21

Compression:

Stored size: 1.26 KB

Contents

module GOVUKDesignSystemFormBuilder
  module Containers
    class RadioButtonsFieldset < Base
      include Traits::Hint
      include Traits::Error

      def initialize(builder, object_name, attribute_name, hint:, legend:, caption:, inline:, small:, form_group:, **kwargs, &block)
        fail LocalJumpError, 'no block given' unless block_given?

        super(builder, object_name, attribute_name, &block)

        @inline          = inline
        @small           = small
        @legend          = legend
        @caption         = caption
        @hint            = hint
        @form_group      = form_group
        @html_attributes = kwargs
      end

      def html
        Containers::FormGroup.new(*bound, **@form_group).html do
          Containers::Fieldset.new(*bound, **fieldset_options).html do
            safe_join([hint_element, error_element, radios])
          end
        end
      end

    private

      def fieldset_options
        {
          legend: @legend,
          caption: @caption,
          described_by: [error_element.error_id, hint_element.hint_id]
        }
      end

      def radios
        Containers::Radios.new(@builder, inline: @inline, small: @small, **@html_attributes).html do
          @block_content
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
govuk_design_system_formbuilder-5.8.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.7.1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.7.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.6.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.5.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.4.1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/govuk_design_system_formbuilder-5.4.0/lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.3.3 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.3.2 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.3.1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.3.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.2.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.1.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.1.0b1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.0.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-5.0.0b1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-4.1.1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-4.1.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-4.0.0 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
govuk_design_system_formbuilder-4.0.0rc1 lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb