Added twig extension to format file size, links to download and delete files attached to the book.

This commit is contained in:
krzysiej
2022-05-24 11:22:35 +02:00
parent 319f6311fc
commit 1f852ac031
5 changed files with 94 additions and 18 deletions

View File

@@ -50,10 +50,10 @@
<tr>
<td>{{ file.id }}</td>
<td>{{ file.fileName }}</td>
<td>{{ file.fileSize }}</td>
<td>{{ file.fileSize | bytes_format }}</td>
<td>{{ file.extension }}</td>
<td>download</td>
<td>remove</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>

View File

@@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello FileController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ 'C:/laragon/www/biblio/src/Controller/FileController.php'|file_link(0) }}">src/Controller/FileController.php</a></code></li>
<li>Your template at <code><a href="{{ 'C:/laragon/www/biblio/templates/file/index.html.twig'|file_link(0) }}">templates/file/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}