170 lines
10 KiB
Twig
170 lines
10 KiB
Twig
{% extends 'base.html.twig' %}
|
|
{% block toolbar %}
|
|
{% if toolbar is defined %}
|
|
<twig:Toolbar toolbar="{{ toolbar }}"/>
|
|
{% endif %}
|
|
{% endblock %}
|
|
{% block body %}
|
|
<div class="relative">
|
|
<div class="shadow-lg text-white">
|
|
<div class="relative h-96 bg-cover bg-center" style="background-image: url('{{ manga.imageUrl }}')">
|
|
<div class="absolute inset-0 bg-black opacity-50"></div>
|
|
<div class="absolute inset-0 flex flex-row justify-center p-4">
|
|
<div class="hidden mr-12 xl:block 2xl:block">
|
|
<img src="{{ manga.imageUrl }}" alt="{{ manga.title }}" class="max-w-72 max-h-72 ml-4">
|
|
</div>
|
|
<div class="flex flex-col">
|
|
<div class="flex items-center mb-4">
|
|
<i class="fas fa-bookmark text-white text-3xl"></i>
|
|
<h1 class="text-3xl font-bold ml-4">{{ manga.title }}</h1>
|
|
</div>
|
|
<div class="flex items-center mb-4">
|
|
<span class="mr-4">{{ manga.publicationYear }}</span>
|
|
<span>Chapters: {{ manga.chapters.count }}</span>
|
|
</div>
|
|
<div class="flex items-center mb-4">
|
|
<i class="fas fa-folder text-gray-400 mr-2"></i>
|
|
<span class="truncate">/media/mangas/{{ manga.title }} ({{ manga.publicationYear }})</span>
|
|
<span class="ml-auto bg-green-600 py-1 px-2 rounded">{{ manga.status ?? 'Terminé' }}</span>
|
|
</div>
|
|
<div class="flex items-center mb-4">
|
|
{% set genre_count = 0 %}
|
|
{% for genre in manga.genres %}
|
|
{% if genre_count < 5 %}
|
|
<span class="bg-gray-700 py-1 px-2 rounded-sm mr-2">{{ genre }}</span>
|
|
{% set genre_count = genre_count + 1 %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if genre_count == 5 and manga.genres|length > 5 %}
|
|
<span class="bg-gray-700 py-1 px-2 rounded-sm mr-2">...</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="mb-4">
|
|
<div class="flex items-center mb-2">
|
|
<i class="fas fa-heart text-red-500 mr-2"></i>
|
|
<span>{{ manga.rating|round(2) }}</span>
|
|
</div>
|
|
<p>{{ manga.description|truncate(500) }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="p-4">
|
|
{% for volume, chapters in chapters_by_volume %}
|
|
{% set is_first = loop.first %}
|
|
{% set volume_cbz_path = chapters|first.cbzPath %}
|
|
{% set all_chapters_same_cbz = chapters|reduce((carry, chapter) => carry and chapter.cbzPath == volume_cbz_path, true) %}
|
|
{% set available_chapters = chapters|filter(chapter => chapter.cbzPath is not null) %}
|
|
{% set total_chapters = chapters|length %}
|
|
|
|
<div data-controller="table" data-table-open-value="{{ is_first ? 'true' : 'false' }}">
|
|
<div class="bg-white rounded-sm shadow mb-4">
|
|
<div class="flex items-center justify-between bg-white p-4 rounded-t-sm">
|
|
<div class="flex flex-row gap-4">
|
|
<i class="fas fa-bookmark text-gray-500 text-3xl"></i>
|
|
<h2 class="text-xl font-semibold">Volume {{ '%02d'|format(volume) }}</h2>
|
|
<div class="flex items-center">
|
|
<span
|
|
class="px-2 py-1 text-sm rounded {{ available_chapters|length > 0 ? 'bg-green-500 text-white' : 'bg-red-500 text-white' }}">
|
|
{{ available_chapters|length }} / {{ total_chapters }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<span class="text-gray-600 mr-2">{{ chapters|length }} Chapters</span>
|
|
<i data-table-target="toggleIcon" data-action="click->table#toggle"
|
|
class="fas fa-chevron-{{ is_first ? 'up' : 'down' }} cursor-pointer"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-table-target="body"
|
|
class="p-4 border-t" {{ not is_first ? 'style="display: none;"' : '' }}>
|
|
<table class="min-w-full table-auto">
|
|
<thead>
|
|
<tr>
|
|
<th class="px-4 py-2 text-left">#</th>
|
|
<th class="px-4 py-2 text-left">Title</th>
|
|
<th class="px-4 py-2 text-right">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% if all_chapters_same_cbz and volume_cbz_path is not null %}
|
|
<tr class="border-t hover:bg-green-100">
|
|
<td class="px-4 py-2 text-green-500">
|
|
<a href="{{ path('app_manga_read', { mangaSlug: manga.slug, chapterNumber: chapters|first.number, pageNumber: 1 }) }}">
|
|
{{ '%02d'|format(volume) }}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-2 w-full text-left">
|
|
<a href="{{ path('app_manga_read', { mangaSlug: manga.slug, chapterNumber: chapters|first.number, pageNumber: 1 }) }}">
|
|
Volume {{ '%02d'|format(volume) }}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-2 flex justify-end gap-2">
|
|
<a href="{{ path('download_cbz', {chapterId: chapters|first.id}) }}"
|
|
class="text-gray-500 hover:text-green-500">
|
|
<i class="fas fa-download"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
{% for chapter in chapters %}
|
|
<tr class="border-t hover:bg-green-100">
|
|
{% if chapter.cbzPath is not null %}
|
|
<td class="px-4 py-2 text-green-500">
|
|
<a href="{{ path('app_manga_read', { mangaSlug: manga.slug, chapterNumber: chapter.number, pageNumber: 1 }) }}">
|
|
{{ '%02d'|format(chapter.number) }}
|
|
</a>
|
|
</td>
|
|
{% else %}
|
|
<td class="px-4 py-2">{{ '%02d'|format(chapter.number) }}</td>
|
|
{% endif %}
|
|
|
|
<td class="px-4 py-2 w-full text-left">
|
|
{% if chapter.cbzPath is not null %}
|
|
<a href="{{ path('app_manga_read', { mangaSlug: manga.slug, chapterNumber: chapter.number, pageNumber: 1 }) }}">
|
|
{{ chapter.title ?? 'No title' }}
|
|
</a>
|
|
{% else %}
|
|
{{ chapter.title ?? 'No title' }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="px-4 py-2 flex justify-end gap-2">
|
|
{% if chapter.cbzPath is null %}
|
|
<button
|
|
data-controller="download-chapter"
|
|
data-action="click->download-chapter#handleClick"
|
|
data-url="{{ path('add_chapter', {id: chapter.id}) }}"
|
|
>
|
|
<span class="text-gray-500 hover:text-green-500">
|
|
<i data-download-chapter-target="icon"
|
|
class="fas fa-search"></i>
|
|
</span>
|
|
</button>
|
|
{% else %}
|
|
<button disabled>
|
|
<span class="text-gray-500">
|
|
<i class="fas fa-search"></i>
|
|
</span>
|
|
</button>
|
|
{% endif %}
|
|
<a href="{{ path('download_cbz', {chapterId: chapter.id}) }}"
|
|
class="text-gray-500 hover:text-green-500">
|
|
<i class="fas fa-download"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endblock %}
|