Sha256: 1eced78014a927145b11f5516b8aae08c9dba964f1693ea9cd7547821531dd27

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

require_relative '../input'

module CCS
  module Components
    module GovUK
      class Field < Base
        class Input < Field
          # = GOV.UK File Upload
          #
          # This is used for generating the file upload component from the
          # {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload}

          class FileUpload < Input
            # @param (see CCS::Components::GovUK::Field::Input#initialize)
            #
            # @option (see CCS::Components::GovUK::Field::Input#initialize)

            # Generates the HTML for the GOV.UK File Upload component
            #
            # @return [ActiveSupport::SafeBuffer]

            def render
              super do
                if options[:form]
                  options[:form].file_field(attribute, **options[:attributes])
                else
                  context.file_field_tag(attribute, **options[:attributes])
                end
              end
            end

            # The default attributes for the file upload

            DEFAULT_ATTRIBUTES = { class: 'govuk-file-upload' }.freeze
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-2.0.0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.2.0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.1.2 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.1.1 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.1.0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-1.0.0 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/components/govuk/field/input/file_upload.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/components/govuk/field/input/file_upload.rb