mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-09-01 18:03:29 +02:00
Extracted file entry to dedicated component
This commit is contained in:
36
app/themes/default/components/file.twig
Normal file
36
app/themes/default/components/file.twig
Normal file
@@ -0,0 +1,36 @@
|
||||
<a
|
||||
href="{% if parentDir %}..{% else %}{{ file.getRelativePathname }}{% endif %}"
|
||||
class="flex justify-between items-center rounded-lg p-4 hover:bg-gray-200 hover:p-4 hover:shadow"
|
||||
>
|
||||
<div class="flex-shrink pr-2">
|
||||
{% if parentDir %}
|
||||
<i class="fas fa-level-up-alt fa-fw fa-lg"></i>
|
||||
{% else %}
|
||||
{{ icon(file) | raw }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex-grow truncate mr-2">
|
||||
{% if parentDir %}
|
||||
..
|
||||
{% else %}
|
||||
{{ file.getBasename }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right mx-2 w-1/6 sm:block">
|
||||
{% if parentDir or file.isDir %}
|
||||
—
|
||||
{% else %}
|
||||
{{ sizeForHumans(file.getSize) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right truncate ml-2 w-1/4 sm:block">
|
||||
{% if parentDir %}
|
||||
—
|
||||
{% else %}
|
||||
{{ file.getMTime | date }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
@@ -34,53 +34,13 @@
|
||||
</div>
|
||||
|
||||
{% if not is_root %}
|
||||
<a
|
||||
href=".."
|
||||
class="flex justify-between items-center rounded-lg p-4 hover:bg-gray-200 hover:p-4 hover:shadow"
|
||||
>
|
||||
<div class="flex-shrink text-gray-700 pr-2">
|
||||
<i class="fas fa-level-up-alt fa-fw fa-lg"></i>
|
||||
</div>
|
||||
|
||||
<div class="flex-grow truncate mr-2">
|
||||
..
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right mx-2 w-1/6 sm:block">
|
||||
—
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right truncate ml-2 w-1/4 sm:block">
|
||||
—
|
||||
</div>
|
||||
</a>
|
||||
{{ include('components/file.twig', {
|
||||
parentDir: true
|
||||
}, with_context = false) }}
|
||||
{% endif %}
|
||||
|
||||
{% for file in files %}
|
||||
<a
|
||||
href="{{ file.getRelativePathname }}"
|
||||
class="flex justify-between items-center rounded-lg p-4 hover:bg-gray-200 hover:p-4 hover:shadow"
|
||||
>
|
||||
<div class="flex-shrink text-gray-700 pr-2">
|
||||
{{ icon(file) | raw }}
|
||||
</div>
|
||||
|
||||
<div class="flex-grow truncate mr-2">
|
||||
{{ file.getBasename }}
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right mx-2 w-1/6 sm:block">
|
||||
{% if file.isDir %}
|
||||
—
|
||||
{% else %}
|
||||
{{ sizeForHumans(file.getSize) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="hidden whitespace-no-wrap text-right truncate ml-2 w-1/4 sm:block">
|
||||
{{ file.getMTime | date }}
|
||||
</div>
|
||||
</a>
|
||||
{{ include('components/file.twig') }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user