- turbo-stream for Chapter updates
- progressbar for chapter scrapping
- minor optimisations
This commit is contained in:
Jérémy Guillot
2024-07-17 20:20:19 +02:00
parent 4672886a67
commit 7fc2f15f6b
14 changed files with 111 additions and 63 deletions

View File

@@ -1,5 +1,5 @@
<turbo-frame id="chapter_list">
<div class="p-4">
<div class="p-4" {{ turbo_stream_listen('App\\Entity\\Chapter') }}>
{% for volume, chapters in chapters_by_volume %}
{% set is_first = loop.first %}
{% set volume_cbz_path = chapters|first.cbzPath %}
@@ -63,7 +63,7 @@
<th class="px-4 py-2 text-right">Actions</th>
</tr>
</thead>
<tbody>
<tbody id="volume-{{ volume }}">
{% 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">
@@ -85,54 +85,7 @@
</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 data-turbo-frame="_top" 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 data-turbo-frame="_top" 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"
data-action="download#download"
data-download-url-value="{{ path('search_chapter', {id: chapter.id}) }}"
>
<span class="text-gray-500 hover:text-green-500">
<i data-download-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="#"
data-controller="download"
data-action="download#download"
data-download-url-value="{{ path('download_cbz', {chapterId: chapter.id}) }}"
class="w-8 text-center">
<i data-download-target="icon"
class="fas fa-download text-gray-500 hover:text-green-500"></i>
</a>
</td>
</tr>
{% include 'manga/_chapter_row.html.twig' with {'chapter': chapter, 'manga': manga} %}
{% endfor %}
{% endif %}
</tbody>