{% load rules %}

{# Projectroles dependency #}
{% load projectroles_common_tags %}

{% has_perm 'filesfolders.update_data_own' request.user file.project as can_update_own %}
{% has_perm 'filesfolders.update_data_all' request.user file.project as can_update_all %}

<div class="btn-group sodar-list-btn-group" id="sodar-ff-file-buttons-{{ file.sodar_uuid }}">
  <button class="btn btn-secondary dropdown-toggle sodar-list-dropdown"
      type="button" data-toggle="dropdown" aria-expanded="false">
    <i class="iconify" data-icon="mdi:cog"></i>
  </button>
  <div class="dropdown-menu dropdown-menu-right">
    {% if can_update_all or file.owner == request.user and can_update_own %}
      <a class="dropdown-item" href="{% url 'filesfolders:file_update' item=file.sodar_uuid %}">
        <i class="iconify" data-icon="mdi:lead-pencil"></i> Update File
      </a>
      <a class="dropdown-item text-danger" href="{% url 'filesfolders:file_delete' item=file.sodar_uuid %}">
        <i class="iconify" data-icon="mdi:close-thick"></i> Delete File
      </a>
      {% get_history_dropdown obj=file project=file.project as history_item %}
      {{ history_item|safe }}
    {% endif %}
  </div>
</div>
