Sha256: a49beef2e8f63c887533be5fce71004b7d0af7987026e696f9fc1807b84d2081

Contents?: true

Size: 539 Bytes

Versions: 3

Compression:

Stored size: 539 Bytes

Contents

module GOVUKDesignSystemFormBuilder
  module Containers
    class FormGroup < GOVUKDesignSystemFormBuilder::Base
      def initialize(builder, object_name, attribute_name)
        super(builder, object_name, attribute_name)
      end

      def html
        content_tag('div', class: form_group_classes) do
          yield
        end
      end

    private

      def form_group_classes
        %w(govuk-form-group).tap do |classes|
          classes.push('govuk-form-group--error') if has_errors?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-1.0.1 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-1.0.0 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.8 lib/govuk_design_system_formbuilder/containers/form_group.rb