Class: CCS::Components::GovUK::Field::Input::FileUpload

Inherits:
CCS::Components::GovUK::Field::Input show all
Defined in:
lib/ccs/components/govuk/field/input/file_upload.rb

Overview

GOV.UK File Upload

This is used for generating the file upload component from the GDS - Components - File Upload

Constant Summary collapse

DEFAULT_ATTRIBUTES =

The default attributes for the file upload

{ class: 'govuk-file-upload' }.freeze

Instance Method Summary collapse

Methods inherited from CCS::Components::GovUK::Field::Input

#initialize

Methods inherited from CCS::Components::GovUK::Field

#initialize

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CCS::Components::GovUK::Field::Input

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK File Upload component

Returns:

  • (ActiveSupport::SafeBuffer)


22
23
24
25
26
27
28
29
30
# File 'lib/ccs/components/govuk/field/input/file_upload.rb', line 22

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