Handling js upload files and displayling list of files by vue component.

This commit is contained in:
krzysiej
2022-06-01 14:56:56 +02:00
parent 26bd59f3bb
commit 1a5445a84a
7 changed files with 69 additions and 41 deletions

View File

@@ -34,36 +34,12 @@
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>File name</th>
<th class="text-end">File size</th>
<th>Extension</th>
<th>Download</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
{% for file in book.files %}
<tr>
<td>{{ file.id }}</td>
<td>{{ file.fileName }}</td>
<td class="text-end">{{ file.fileSize | bytes_format }}</td>
<td>{{ file.extension }}</td>
<td><a href="{{ path('app_file_download', {id: file.id }) }}" class="link-secondary">download</a></td>
<td><a href="{{ path('app_file_delete', {id: file.id}) }}" class="link-danger">remove</a></td>
</tr>
{% else %}
<tr>
<td colspan="6">no files found</td>
</tr>
{% endfor %}
</table>
<div id="app">
<files></files>
</div>
{{ form_start(file_form) }}
{{ form_widget(file_form) }}
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
{{ form_end(file_form) }}
<a href="{{ path('app_book_index') }}">back to list</a>
@@ -72,3 +48,9 @@
{{ include('book/_delete_form.html.twig') }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('files') }}
{% endblock %}