Sha256: 99371dc0f9170ffb80bc331a5b16d40355f4fb73098174eea12cc1002c5e056e

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

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

      def initialize(builder, object_name, attribute_name, hint_text:, legend:, small:, classes:, &block)
        super(builder, object_name, attribute_name, &block)

        @legend        = legend
        @hint_text     = hint_text
        @small         = small
        @classes       = classes
        @block_content = capture { block.call }
      end

      def html
        Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
          Containers::Fieldset.new(@builder, @object_name, @attribute_name, legend: @legend, described_by: [error_element.error_id, hint_element.hint_id]).html do
            safe_join(
              [
                hint_element.html,
                error_element.html,
                Containers::CheckBoxes.new(@builder, small: @small, classes: @classes).html do
                  @block_content
                end
              ]
            )
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-1.1.11 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.2.0b2 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.2.0b1 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.10 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.9 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.8 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.7 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.6 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.5 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
govuk_design_system_formbuilder-1.1.4 lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb