Moved book listing to the vue component.
This commit is contained in:
@@ -5,7 +5,11 @@
|
||||
{% block body %}
|
||||
<div class="d-flex flex-row justify-content-between align-items-center">
|
||||
<div>
|
||||
<h1>Book list</h1>
|
||||
{% if(searchTerm) %}
|
||||
<h1>Book search: {{ searchTerm }}</h1>
|
||||
{% else %}
|
||||
<h1>Book list</h1>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{ path('app_book_new') }}" class="btn btn-primary">Add new</a>
|
||||
@@ -13,45 +17,12 @@
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Title</th>
|
||||
<th>Description</th>
|
||||
<th>Rating</th>
|
||||
<th>Publisher</th>
|
||||
<th>Publish date</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for book in books %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if file_exists(asset('book_covers/cover_' ~ book.id ~ '.jpg')) %}
|
||||
<a href="{{ path('app_book_show', {'id': book.id}) }}"><img class="img-thumbnail"
|
||||
style="max-width: 80px"
|
||||
src="{{ asset('book_covers/cover_' ~ book.id ~ '.jpg' ) }}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><a href="{{ path('app_book_show', {'id': book.id}) }}"
|
||||
class="text-decoration-none">{{ book.title }}</a></td>
|
||||
<td>{{ book.description | slice(0, 200) }}</td>
|
||||
<td>{% if book.rating %}{% for i in range(1, book.rating) %}⭐{% endfor %}{% endif %}</td>
|
||||
<td>{{ book.publisher }}</td>
|
||||
<td>{{ book.publishDate ? book.publishDate|date('Y-m-d') : '' }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_book_show', {'id': book.id}) }}" class="text-decoration-none">show</a>
|
||||
<a href="{{ path('app_book_edit', {'id': book.id}) }}" class="text-decoration-none">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="9">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="app">
|
||||
<book-listing></book-listing>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ encore_entry_script_tags('book') }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user