{% load truncatepath %}
{% load static_url %}
<div class="accordion" id="files">
  <div class="card">
    <div class="card-header" id="files_card">
      <button class="btn" type="button" data-toggle="collapse" data-target="#collapse_files" aria-expanded="false" aria-controls="collapse_files">
        <h4>
          <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-files" viewBox="0 0 16 16">
            <path d="M13 0H6a2 2 0 0 0-2 2 2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2 2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 13V4a2 2 0 0 0-2-2H5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zM3 4a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4z"/>
          </svg>
          Files
        </h4>
      </button>
    </div>
    <div id="collapse_files" class="collapse show" aria-labelledby="files_card" data-parent="#files" style="max-height: 275px; overflow-y: auto;">
      <div class="card-body">
        {% if playbook.items.files %}
          <ul>
            {% for file in files %}
              {% url 'ui:file' file.id as file_url %}
              <li><a href="{% static_url file_url %}" title="{{ file.path }}">{{ file.path | truncatepath:70 }}</a></li>
            {% endfor %}
          </ul>
        {% else %}
          <p>No recorded files found.</p>
          <p>The playbook might have been interrupted or is in progress.</p>
        {% endif %}
      </div>
    </div>
  </div>
</div>
