Removed encore added books crud
This commit is contained in:
4
templates/book/_delete_form.html.twig
Normal file
4
templates/book/_delete_form.html.twig
Normal 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>
|
||||
4
templates/book/_form.html.twig
Normal file
4
templates/book/_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
13
templates/book/edit.html.twig
Normal file
13
templates/book/edit.html.twig
Normal 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 %}
|
||||
49
templates/book/index.html.twig
Normal file
49
templates/book/index.html.twig
Normal 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 %}
|
||||
11
templates/book/new.html.twig
Normal file
11
templates/book/new.html.twig
Normal 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 %}
|
||||
50
templates/book/show.html.twig
Normal file
50
templates/book/show.html.twig
Normal 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 %}
|
||||
Reference in New Issue
Block a user