Added:
- manga import - read from cbz - save cbz from scrapping - menu interactions
This commit is contained in:
@@ -22,21 +22,19 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<div
|
||||
class="w-full p-4 grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-12 gap-4">
|
||||
<div class="w-full p-4 grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-12 gap-4">
|
||||
{% for manga in mangas %}
|
||||
<div
|
||||
class="bg-white overflow-hidden border-gray-300 hover:shadow-2xl hover:border transition-shadow duration-300">
|
||||
<a href="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}">
|
||||
<div class="bg-white overflow-hidden border border-gray-200 hover:shadow-2xl hover:border-gray-400 transition-all duration-300 flex flex-col">
|
||||
<a href="{{ path('app_manga_show', { 'mangaSlug': manga.slug }) }}" class="block relative w-full pb-[150%] overflow-hidden">
|
||||
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}"
|
||||
class="w-full">
|
||||
class="absolute top-0 left-0 w-full h-full object-cover">
|
||||
</a>
|
||||
<div class="p-4">
|
||||
<div class="flex justify-between text-xl">
|
||||
<span>{{ manga.title }}</span>
|
||||
<span class="text-md text-gray-500 ml-2">({{ manga.publicationYear }})</span>
|
||||
<div class="p-2 flex flex-col justify-between flex-grow">
|
||||
<div>
|
||||
<h3 class="text-sm font-semibold truncate">{{ manga.title }}</h3>
|
||||
<p class="text-xs text-gray-500">{{ manga.publicationYear }}</p>
|
||||
</div>
|
||||
<p class="text-gray-500">Added: {{ manga.createdAt|date('M d, Y') }}</p>
|
||||
<p class="text-xs text-gray-400 mt-1">Added: {{ manga.createdAt|date('M d, Y') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
@@ -6,37 +6,56 @@
|
||||
<div class="w-full mx-auto p-4">
|
||||
<h1 class="text-center text-3xl my-4">{{ manga.title }} - Chapitre {{ chapter.number }}</h1>
|
||||
|
||||
{% set isCbz = chapter.cbzPath is not null %}
|
||||
{% set totalPages = isCbz ? totalPages : pages|length %}
|
||||
{% set currentPageNumber = isCbz ? currentPage : currentPage.number %}
|
||||
|
||||
<div class="flex justify-center my-4">
|
||||
{% if currentPage.number > 1 %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}"
|
||||
{% if currentPageNumber > 1 %}
|
||||
<a href="{{ path('app_manga_read', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber - 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
{% endif %}
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}"
|
||||
{% if currentPageNumber < totalPages %}
|
||||
<a href="{{ path('app_manga_read', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber + 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="page-container flex justify-center">
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', {'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1}) }}">
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPage.number }}"
|
||||
class="shadow-lg">
|
||||
</a>
|
||||
{% if isCbz %}
|
||||
{% if currentPageNumber < totalPages %}
|
||||
<a href="{{ path('app_manga_read', {'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber + 1}) }}">
|
||||
<img src="data:image/jpeg;base64,{{ pageContent }}" alt="Page {{ currentPageNumber }}"
|
||||
class="shadow-lg">
|
||||
</a>
|
||||
{% else %}
|
||||
<img src="data:image/jpeg;base64,{{ pageContent }}" alt="Page {{ currentPageNumber }}" class="shadow-lg">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPage.number }}" class="shadow-lg">
|
||||
{% if currentPageNumber < totalPages %}
|
||||
<a href="{{ path('app_manga_read', {'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber + 1}) }}">
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPageNumber }}"
|
||||
class="shadow-lg">
|
||||
</a>
|
||||
{% else %}
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPageNumber }}" class="shadow-lg">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center my-4">
|
||||
{% if currentPage.number > 1 %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}"
|
||||
{% if currentPageNumber > 1 %}
|
||||
<a href="{{ path('app_manga_read', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber - 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
{% endif %}
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}"
|
||||
{% if currentPageNumber < totalPages %}
|
||||
<a href="{{ path('app_manga_read', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPageNumber + 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-4">
|
||||
Page {{ currentPageNumber }} sur {{ totalPages }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -65,27 +65,31 @@
|
||||
|
||||
<div class="p-4">
|
||||
{% for volume, chapters in chapters_by_volume %}
|
||||
{% set non_null_chapters = chapters|filter(chapter => chapter.localPath is not null) %}
|
||||
{% 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">
|
||||
|
||||
<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 {{ volume }}</h2>
|
||||
<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 {{ non_null_chapters|length > 0 ? 'bg-green-500 text-white' : 'bg-red-500 text-white' }}">
|
||||
{{ non_null_chapters|length }} / {{ total_chapters }}
|
||||
</span>
|
||||
<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-action="click->table#collapse" class="fas fa-chevron-down cursor-pointer"></i>
|
||||
<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">
|
||||
|
||||
<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>
|
||||
@@ -95,53 +99,71 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for chapter in chapters %}
|
||||
{% if all_chapters_same_cbz and volume_cbz_path is not null %}
|
||||
<tr class="border-t hover:bg-green-100">
|
||||
{% if chapter.localPath is not null %}
|
||||
<td class="px-4 py-2 text-green-500">
|
||||
<a href="{{ path('read_chapter_page', { mangaSlug: manga.slug, chapterNumber: chapter.number, pageNumber: 1 }) }}">
|
||||
{{ chapter.number }}</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="px-4 py-2">{{ chapter.number }}</td>
|
||||
{% endif %}
|
||||
|
||||
<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">
|
||||
{% if chapter.localPath is not null %}
|
||||
<a class=""
|
||||
href="{{ path('read_chapter_page', { mangaSlug: manga.slug, chapterNumber: chapter.number, pageNumber: 1 }) }}">{{ chapter.title ?? 'No title' }}</a>
|
||||
{% else %}
|
||||
{{ chapter.title ?? 'No title' }}
|
||||
{% endif %}
|
||||
<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">
|
||||
{% if chapter.localPath 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>
|
||||
<span class="text-gray-500" disabled="disabled">
|
||||
<i data-download-chapter-target="icon" class="fas fa-search"></i>
|
||||
</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
<a href="{{ path('download_cbz', {chapterId: chapter.id}) }}" class="text-gray-500 hover:text-green-500">
|
||||
<a href="{{ path('download_cbz', {chapterId: chapters|first.id}) }}" class="text-gray-500 hover:text-green-500">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
{# <a href="#" class="text-gray-500 hover:text-green-500"> #}
|
||||
{# <i class="fas fa-trash"></i> #}
|
||||
{# </a> #}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% 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>
|
||||
|
||||
Reference in New Issue
Block a user