Sha256: c84a5d60bd66c53246eb952bb2891e94366998c7fc12d2272a2a08377aa5c0c1

Contents?: true

Size: 548 Bytes

Versions: 8

Compression:

Stored size: 548 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
        @builder.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

8 entries across 8 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-0.9.7 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.6 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.5 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.4 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.3 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.2 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.1 lib/govuk_design_system_formbuilder/containers/form_group.rb
govuk_design_system_formbuilder-0.9.0 lib/govuk_design_system_formbuilder/containers/form_group.rb