Sha256: 2ab1054fcfc02837bfad2e3ece304de966c07a5f48cf5c879b78c8aeee3c630a

Contents?: true

Size: 1.89 KB

Versions: 25

Compression:

Stored size: 1.89 KB

Contents

{% from "../error-message/macro.njk" import govukErrorMessage -%}
{% from "../hint/macro.njk" import govukHint %}
{% from "../label/macro.njk" import govukLabel %}

{#- a record of other elements that we need to associate with the input using
   aria-describedby – for example hints or error messages -#}
{% set describedBy = "" %}
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
  {{ govukLabel({
    html: params.label.html,
    text: params.label.text,
    classes: params.label.classes,
    isPageHeading: params.label.isPageHeading,
    attributes: params.label.attributes,
    for: params.id
  }) | indent(2) | trim }}
{% if params.hint %}
  {% set hintId = params.id + '-hint' %}
  {% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
  {{ govukHint({
    id: hintId,
    classes: params.hint.classes,
    attributes: params.hint.attributes,
    html: params.hint.html,
    text: params.hint.text
  }) | indent(2) | trim }}
{% endif %}
{% if params.errorMessage %}
  {% set errorId = params.id + '-error' %}
  {% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
  {{ govukErrorMessage({
    id: errorId,
    classes: params.errorMessage.classes,
    attributes: params.errorMessage.attributes,
    html: params.errorMessage.html,
    text: params.errorMessage.text
  }) | indent(2) | trim }}
{% endif %}
  <input class="govuk-file-upload {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} govuk-file-upload--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="file"
  {%- if params.value %} value="{{ params.value }}"{% endif %}
  {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
</div>

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
govuk_publishing_components-16.3.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-16.2.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-16.1.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-16.0.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-15.3.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-15.2.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-15.1.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-15.0.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-14.0.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.8.1 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.8.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.7.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.6.1 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.6.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.5.4 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.5.3 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.5.2 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.5.1 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.5.0 node_modules/govuk-frontend/components/file-upload/template.njk
govuk_publishing_components-13.4.0 node_modules/govuk-frontend/components/file-upload/template.njk