Sha256: a01cdae4316cbbfa91d68c6fdba289b5a4a38ba2470f87d49d01b47c8b7c0e65

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

module GOVUKDesignSystemFormBuilder
  module Elements
    module CheckBoxes
      class FieldsetCheckBox < Base
        include Traits::Label
        include Traits::Hint
        include Traits::HTMLAttributes
        include Traits::FieldsetItem

        def initialize(builder, object_name, attribute_name, value, unchecked_value, label:, hint:, link_errors:, multiple:, **kwargs, &block)
          super(builder, object_name, attribute_name)

          @value           = value
          @unchecked_value = unchecked_value
          @label           = label
          @hint            = hint
          @multiple        = multiple
          @link_errors     = link_errors
          @html_attributes = kwargs

          conditional_content(&block)
        end

      private

        def input_type
          :checkboxes
        end

        def input
          @builder.check_box(@attribute_name, attributes(@html_attributes), @value, @unchecked_value)
        end

        def fieldset_options
          { checkbox: true }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-2.7.0 lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb
govuk_design_system_formbuilder-2.6.0 lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb
govuk_design_system_formbuilder-2.6.0b1 lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb
govuk_design_system_formbuilder-2.5.3 lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb
govuk_design_system_formbuilder-2.5.2 lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb