Removed encore added books crud

This commit is contained in:
krzysiej
2022-05-20 14:53:13 +02:00
parent ac3f054dec
commit 210318eca4
31 changed files with 611 additions and 299 deletions

View File

@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_book_delete', {'id': book.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ book.id) }}">
<button class="btn btn-danger">Delete</button>
</form>

View File

@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Book{% endblock %}
{% block body %}
<h1>Edit Book</h1>
{{ include('book/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_book_index') }}">back to list</a>
{{ include('book/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -0,0 +1,49 @@
{% extends 'base.html.twig' %}
{% block title %}Book index{% endblock %}
{% block body %}
<h1>Book index</h1>
<table class="table">
<thead>
<tr>
<th>Cover</th>
<th>Id</th>
<th>Title</th>
<th>Language</th>
<th>Description</th>
<th>Publisher</th>
<th>Publish_date</th>
<th>Filename</th>
<th>Original_filename</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for book in books %}
<tr>
<td>{% if file_exists(asset('book_covers/cover_' ~ book.id ~ '.jpg')) %}<img class="img-thumbnail" src="{{ asset('book_covers/cover_' ~ book.id ~ '.jpg' ) }}" /> {% endif %}</td>
<td>{{ book.id }}</td>
<td>{{ book.Title }}</td>
<td>{{ book.language }}</td>
<td>{{ book.description }}</td>
<td>{{ book.publisher }}</td>
<td>{{ book.publishDate ? book.publishDate|date('Y-m-d') : '' }}</td>
<td>{{ book.filename }}</td>
<td><a href="{{ path('app_book_download', {'id': book.id}) }} ">{{ book.originalFilename }}</a></td>
<td>
<a href="{{ path('app_book_show', {'id': book.id}) }}">show</a>
<a href="{{ path('app_book_edit', {'id': book.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="9">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_book_new') }}">Create new</a>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Book{% endblock %}
{% block body %}
<h1>Create new Book</h1>
{{ include('book/_form.html.twig') }}
<a href="{{ path('app_book_index') }}">back to list</a>
{% endblock %}

View File

@@ -0,0 +1,50 @@
{% extends 'base.html.twig' %}
{% block title %}Book{% endblock %}
{% block body %}
<h1>Book</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ book.id }}</td>
</tr>
<tr>
<th>Title</th>
<td>{{ book.Title }}</td>
</tr>
<tr>
<th>Language</th>
<td>{{ book.language }}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ book.description }}</td>
</tr>
<tr>
<th>Publisher</th>
<td>{{ book.publisher }}</td>
</tr>
<tr>
<th>Publish_date</th>
<td>{{ book.publishDate ? book.publishDate|date('Y-m-d') : '' }}</td>
</tr>
<tr>
<th>Filename</th>
<td>{{ book.filename }}</td>
</tr>
<tr>
<th>Original_filename</th>
<td>{{ book.originalFilename }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_book_index') }}">back to list</a>
<a href="{{ path('app_book_edit', {'id': book.id}) }}">edit</a>
{{ include('book/_delete_form.html.twig') }}
{% endblock %}