Sha256: 509f0b3a8d140e18b4b23d21c9c82d49e9cb84c0c3cb961ceb1a332e32137da6

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 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) }}
  {% endfor %}
</ul>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
defra_ruby_template-5.4.1 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk
defra_ruby_template-5.4.0 node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk