{#
/**
 * @file
 * Theme override to display a list of summary lines.
 *
 * Available variables:
 * - rows: The rows contained in this view.
 *   Each row contains:
 *   - url: The summary link URL.
 *   - link: The summary link text.
 *   - count: The number of items under this grouping.
 *   - attributes: HTML attributes to apply to each row.
 *   - active: A flag indicating whether the row is active.
 * - options: Flags indicating how the summary should be displayed.
 *   This contains:
 *   - count: A flag indicating whether the count should be displayed.
 *
 * @see template_preprocess_views_view_summary()
 */
#}

{% set list_group_rows = [] %}

{% for row in rows %}
  {% set list_item_content = row.link %}

  {% if options.count %}
    {% set list_item_content = list_item_content~ '(' ~ row.count ~ ')' %}
  {% endif %}

  {%
    set list_group_row = include ('vartheme_bs5:link', {
      url: row.url,
      content: list_item_content,
      link_utility_classes: [row.active ? 'is-active']
      }, with_context = false)
  %}

  {% set list_group_rows = list_group_rows|merge([list_group_row]) %}
{% endfor %}

<div class="item-list">
  {{
    include('vartheme_bs5:list-group', {
      type: 'ul',
      rows: list_group_rows,
      list_group_utility_classes: ['views-summary']
    }, with_context = false)
  }}
</div>
