add links to enter / exit folders

Reviewed-on: sites/file-explorer#5
This commit is contained in:
2024-12-05 10:58:30 +00:00
parent bf226d7e3f
commit a574c3a89a
8 changed files with 66 additions and 14 deletions

View File

@ -1,13 +1,24 @@
{% if file.name == '..' %}
{% set link = routing_service.goBack(app.request) %}
{% else %}
{% set link = path('app_home', {dirs: app.request.attributes.get('dirs', '/') ~ file.name ~ '/'}) %}
{% endif %}
<tr class="border-b">
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
{% if file.type == 'dir' %}
{{ ux_icon('folder:closed', {height: '32px', width: '32px'}) }}
{% else %}
{{ ux_icon('file:default', {height: '32px', width: '32px'}) }}
{% endif %}
<a href="{{ link }}">
{% if file.type == 'dir' %}
{{ ux_icon('folder:closed', {height: '32px', width: '32px'}) }}
{% else %}
{{ ux_icon('file:default', {height: '32px', width: '32px'}) }}
{% endif %}
</a>
</th>
<td class="px-6 py-4">
{{ file.name }}
<a href="{{ link }}">
{{ file.name }}
</a>
</td>
<td class="px-6 py-4">
{{ file.size }}

View File

@ -14,6 +14,9 @@
</tr>
</thead>
<tbody>
{% if app.request.requestUri != '/files' %}
{% include '_partials/_row.html.twig' with {file: {name: '..', size: '-', type: 'dir'}} %}
{% endif %}
{% for dirContent in content %}
{% include '_partials/_row.html.twig' with {file: dirContent} %}
{% endfor %}
@ -24,10 +27,12 @@
{{ form_start(fileForm, {'attr': {'data-controller': 'upload-file'}}) }}
<div class="flex items-center justify-center max-w-4xl mt-5">
<label for="upload_file_form_file" class="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-gray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600">
<label for="upload_file_form_file"
class="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-gray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
{{ ux_icon('file:upload', {height: '64px', width: '64px'}) }}
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click to upload</span> or drag and drop</p>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click to upload</span>
or drag and drop</p>
</div>
{{ form_widget(fileForm.file) }}
<button type="submit" class="hidden"></button>