{# following line commented to prevent empty tagsname #}
{# {{ include_javascript('javascripts/vendor/datatables-full/jquery.dataTables.min.js') }} #}
{{ include_css('styles/vendor/datatables-full/dataTables.bootstrap.min.css') }}
<table class="table table-striped table-condensed">
  <thead>
    <tr>
      <th>Page</th>
      <th>{{ _t('TAGS_PRESENT_IN') }}</th>
      {% if isAdmin %}<th>Action</th>{% endif %}
    </tr>
  </thead>
  <tbody>
    {% for tagName, tagsForName in tags %}
      {% for index,tag in tagsForName %}
        <tr>
          <td{% if index == 0 %} class="taglistitem"{% endif %}>
            {%- if index == 0 %}<span class="tag-label label label-primary">{{ tagName }}</span>{% endif -%}
          </td>
          <td class="pagewithtag">
            {{ _t('TAGS_PRESENT_IN') }} : <a class="wikipagelink" href="{{ url({tag:tag.resource}) }}">{{ tag.resource }}</a>
          </td>
          {% if isAdmin %}
          <td class="delete_tag">
            <a class="btn btn-xs btn-mini btn-error btn-danger" 
              href="{{ url({params:{delete_tag:tag.id}}) }}">
              <i class="icon icon-trash icon-white"></i>
              {{- ' ' ~ _t('TAGS_DELETE_MINUSCULE') }} {{ _t('TAGS_FROM_THIS_PAGE') -}}
            </a>
          </td>
          {% endif %}
				</tr>
      {% endfor %}{# tagsForName #}
      {% if tagsForName|length > 1 %}
        <tr>
          <td></td>
          <td></td>
          {% if isAdmin %}
          <td class="delete_all_tags">
            <a class="btn btn-xs btn-mini btn-error btn-danger" 
                href="{{ url({params:{delete_tag:tagsForName|map(tag => tag.id)|join(',')}}) }}">
              <strong>
                <i class="icon icon-trash icon-white"></i>
                  {{- _t('TAGS_DELETE_MINUSCULE') }}&nbsp;<span class="tag-label label label-primary">{{ tagName }}</span>
                  {{ ' ' ~ _t('TAGS_FROM_ALL_PAGES') -}}
              </strong>
            </a>
          </td>
          {% endif %}
        </tr>
      {% endif %}
    {% endfor %}{# tags #}
  </tbody>
</table>