Sha256: 9bec9f433629b6c6073889ee5f769b1456f11da8b4c047740b8db3f1aca96075

Contents?: true

Size: 1.9 KB

Versions: 36

Compression:

Stored size: 1.9 KB

Contents

{% from "../../macros/attributes.njk" import govukAttributes %}
{% from "../tag/macro.njk" import govukTag %}

{%- set idPrefix = params.idPrefix if params.idPrefix else "task-list" -%}

{%- macro _taskListItem(params, item, index) %}
  {%- set hintId = idPrefix + "-" + index + "-hint" %}
  {%- set statusId = idPrefix + "-" + index + "-status" %}
  <li class="govuk-task-list__item {%- if item.href %} govuk-task-list__item--with-link{% endif %}{%- if item.classes %} {{ item.classes }}{% endif %}">
    <div class="govuk-task-list__name-and-hint">
    {% if item.href %}
      <a class="govuk-link govuk-task-list__link {%- if item.title.classes %} {{ item.title.classes }}{% endif %}" href="{{ item.href }}" aria-describedby="{{ hintId + " " if item.hint }}{{ statusId }}">
        {{ item.title.html | safe | trim | indent(8) if item.title.html else item.title.text }}
      </a>
    {% else %}
      <div {%- if item.title.classes %} class="{{ item.title.classes }}"{% endif %}>
        {{ item.title.html | safe | trim | indent(8) if item.title.html else item.title.text }}
      </div>
    {% endif %}
    {% if item.hint %}
      <div id="{{ hintId }}" class="govuk-task-list__hint">
        {{ item.hint.html | safe | trim | indent(8) if item.hint.html else item.hint.text }}
      </div>
    {% endif %}
    </div>
    <div class="govuk-task-list__status {%- if item.status.classes %} {{ item.status.classes }}{% endif %}" id="{{ statusId }}">
    {% if item.status.tag %}
      {{ govukTag(item.status.tag) | trim | indent(6) }}
    {% else %}
      {{ item.status.html | safe | trim | indent(6) if item.status.html else item.status.text }}
    {% endif %}
    </div>
  </li>
{%- endmacro %}

<ul class="govuk-task-list {%- if params.classes %} {{ params.classes }}{% endif %}"
  {{- govukAttributes(params.attributes) }}>
  {% for item in params.items %}
    {{- _taskListItem(params, item, loop.index) if item }}
  {% endfor %}
</ul>

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
govuk_publishing_components-44.4.1 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-44.4.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-44.3.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-44.2.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-44.1.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-44.0.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.5.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.4.1 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.4.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.3.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.2.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.1.1 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.1.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.0.2 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.0.1 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
govuk_publishing_components-43.0.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk