88 lines
2.9 KiB
Twig
88 lines
2.9 KiB
Twig
{% extends 'base.html.twig' %}
|
|
|
|
{% block title %}Book{% endblock %}
|
|
|
|
{% block body %}
|
|
|
|
<div id="app">
|
|
{% set progress_pages = book.getProgress() | length ? (book.getProgress().first().pages) : 0 %}
|
|
{% set progress = (progress_pages / book.pages*100) | round %}
|
|
|
|
<progressbar :read-pages="{{ progress_pages }}" :total-pages="{{ book.pages }}"></progressbar>
|
|
<div class="d-flex">
|
|
<div>
|
|
{% if file_exists(asset('book_covers/cover_' ~ book.id ~ '.jpg')) %}
|
|
<img class="img-thumbnail"
|
|
style="max-width: 80px"
|
|
src="{{ asset('book_covers/cover_' ~ book.id ~ '.jpg' ) }}"/> {% endif %}
|
|
</div>
|
|
<div class="mx-3">
|
|
<h1>{{ book.title }}</h1>
|
|
<h3>{{ book.subtitle }}</h3>
|
|
<p>{{ book.author }}</p>
|
|
<p>{% if book.rating %}{% for i in range(1, book.rating) %}⭐{% endfor %}{% endif %}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="table">
|
|
<tbody>
|
|
<tr>
|
|
<th>Category</th>
|
|
<td>{{ book.category }}</td>
|
|
<th>Tags</th>
|
|
<td>{{ book.tags }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Description</th>
|
|
<td colspan="3">{{ book.description | nl2br }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Publisher</th>
|
|
<td>{{ book.publisher }}</td>
|
|
<th>Publish date</th>
|
|
<td>{{ book.publishDate ? book.publishDate|date('Y-m-d') : '' }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>ISBN</th>
|
|
<td>{{ book.isbn }}</td>
|
|
<th>Language</th>
|
|
<td>{{ book.language }}</td>
|
|
</tr>
|
|
{% if(book.series) %}
|
|
<tr>
|
|
<th>Series</th>
|
|
<td colspan="3">{{ book.series }} {{ book.volume }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
<tr>
|
|
<th>Progress</th>
|
|
<td>
|
|
<progresseditor :book-id="{{ book.id }}"
|
|
:read-pages="{{ progress_pages }}"
|
|
:total-pages="{{ book.pages }}"></progresseditor>
|
|
</td>
|
|
<th>Pages</th>
|
|
<td>{{ book.pages }}</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
<files :book-id="{{ book.id }}"></files>
|
|
</div>
|
|
|
|
{# {{ form_start(file_form) }}#}
|
|
{# {{ form_widget(file_form) }}#}
|
|
{# {{ form_end(file_form) }}#}
|
|
|
|
<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 %}
|
|
|
|
|
|
{% block javascripts %}
|
|
{{ parent() }}
|
|
{{ encore_entry_script_tags('files') }}
|
|
{% endblock %} |