Sha256: 14742b8be0ab1d840b47c9c3f36a198658bcfa6a7829983a17d1ee42c853c941
Contents?: true
Size: 1.28 KB
Versions: 10
Compression:
Stored size: 1.28 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) def initialize(attribute:, **options) super(attribute: attribute, **options) end # 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