You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
48 lines
1.5 KiB
{% macro bytesToSize(bytes) %}
|
|
{% apply spaceless %}
|
|
{% set kilobyte = 1024 %}
|
|
{% set megabyte = kilobyte * 1024 %}
|
|
{% set gigabyte = megabyte * 1024 %}
|
|
{% set terabyte = gigabyte * 1024 %}
|
|
|
|
{% if bytes < kilobyte %}
|
|
{{ bytes ~ ' B' }}
|
|
{% elseif bytes < megabyte %}
|
|
{{ (bytes / kilobyte)|number_format(2, '.') ~ ' KB' }}
|
|
{% elseif bytes < gigabyte %}
|
|
{{ (bytes / megabyte)|number_format(2, '.') ~ ' MB' }}
|
|
{% elseif bytes < terabyte %}
|
|
{{ (bytes / gigabyte)|number_format(2, '.') ~ ' GB' }}
|
|
{% else %}
|
|
{{ (bytes / terabyte)|number_format(2, '.') ~ ' TB' }}
|
|
{% endif %}
|
|
{% endapply %}
|
|
{% endmacro %}
|
|
|
|
{% if files %}
|
|
<table class="table">
|
|
<tr>
|
|
<th>{{ 'Path' | get_lang }}</th>
|
|
<th>{{ 'Size' | get_lang }}</th>
|
|
<th>{{ 'Detail' | get_lang }}</th>
|
|
</tr>
|
|
{% for file in files %}
|
|
<tr>
|
|
<td>
|
|
{{ file.path }}
|
|
</td>
|
|
<td>
|
|
{{ _self.bytesToSize(file.size) }}
|
|
</td>
|
|
|
|
<td>
|
|
<a href="{{ web_self }}?{{web_cid_query}}&action=download&id={{ file.id }}" class="btn btn--plain">{{ 'Download' | get_lang }}</a>
|
|
<a href="{{ web_self }}?{{web_cid_query}}&action=delete&id={{ file.id }}" class="btn btn--danger">{{ 'Delete' | get_lang }}</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% else %}
|
|
{{ 'No data available' | get_lang }}
|
|
{% endif %}
|
|
|
|
|