{#
  Copyright (C) 2020 CERN.
  Copyright (C) 2020 Northwestern University.
  Copyright (C) 2021 Graz University of Technology

  Invenio RDM Records is free software; you can redistribute it and/or modify
  it under the terms of the MIT License; see LICENSE file for more details.
#}

{% from 'invenio_previewer/macros.html' import file_list, preview_file %}

{% macro preview_file_box(file, pid) %}
<div class="panel-spacing">
  <div class="ui accordion panel" id="preview" href="#collapsablePreview">
    <div class="active title panel-heading">
      {{file.key}}
      <i class="angle down icon"></i>
    </div>
    <div id="collapsablePreview" class="active content">
      {{ preview_file('invenio_records_ui.recid_previewer', pid=pid, filename=file.key) }}
    </div>
  </div>
</div>
{%- endmacro %}



{% macro file_list_box(files, pid) %}
<div class="panel-spacing">
  <div class="ui accordion panel" id="preview" href="#collapsablePreview">
    <div class="title panel-heading">
      {{ _("Files") }}
      <small class="text-muted">{% if files %} ({{files|sum(attribute='size')|filesizeformat}}){% endif %}</small>
      <i class="angle down icon"></i>
    </div>
    <div class="active content">
      <div id="collapsableFiles">
        {{ file_list(files, pid) }}
      </div>
    </div>
  </div>
</div>


{%- endmacro %}
