Sha256: 32e7ca3f956db7977a826cb5e05d503e6e0f5b4ec55ae408dd2101cd7bb1f13b

Contents?: true

Size: 759 Bytes

Versions: 7

Compression:

Stored size: 759 Bytes

Contents

module GOVUKDesignSystemFormBuilder
  module Elements
    module CheckBoxes
      class Hint
        def initialize(builder, attribute, checkbox, text)
          @builder = builder
          @attribute = attribute
          @checkbox = checkbox
          @text    = text
        end

        def html
          return nil if @text.blank?

          @builder.tag.span(@text, class: hint_classes, id: id)
        end

        def id
          return nil if @text.blank?

          [
            @attribute,
            @checkbox.object.id,
            'hint'
          ]
            .join('-')
            .parameterize
        end

      private

        def hint_classes
          %w(govuk-hint govuk-checkboxes__hint)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-0.7.6 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.5 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.4 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.3 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.2 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.1 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb
govuk_design_system_formbuilder-0.7.0 lib/govuk_design_system_formbuilder/elements/check_boxes/hint.rb