- new simpler modal without bootstrap
- new loadingbutton component
- cleanupsome old code
- toolbar adjusments
This commit is contained in:
Jérémy Guillot
2024-06-30 12:44:41 +02:00
parent b4f0811bca
commit ba30d3102d
23 changed files with 403 additions and 302 deletions

View File

@@ -22,43 +22,92 @@
{% if this.mangas %}
<div data-loading="addClass(opacity-50)" class="mt-3">
{% for manga in this.mangas %}
<div class="flex w-full bg-white shadow-lg mb-8 hover:bg-green-50" data-bs-toggle="modal"
data-bs-target="#mangaModal{{ loop.index }}-{{ manga.slug }}">
<a href="#" class="flex-none w-48 relative">
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}"
class="w-full h-full -z-10 object-cover" style="width: 150px; height: 220px;">
</a>
<div class="w-full p-4 flex flex-col justify-between leading-normal">
<div class="mb-2">
<div class="flex w-full text-xl font-bold text-gray-900 mb-4 items-center justify-between">
<div class="flex items-center">
<span>{{ manga.title }}</span>
<span class="text-2xl text-gray-500 ml-2">({{ manga.publicationYear }})</span>
<div {{ stimulus_controller('addmanga', { 'index': loop.index })}}>
<div class="flex w-full bg-white shadow-lg mb-8 hover:bg-green-50"
data-action="click->addmanga#openModal">
<a href="#" class="flex-none w-48 relative">
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}"
class="w-full h-full -z-10 object-cover" style="width: 150px; height: 220px;">
</a>
<div class="w-full p-4 flex flex-col justify-between leading-normal">
<div class="mb-2">
<div
class="flex w-full text-xl font-bold text-gray-900 mb-4 items-center justify-between">
<div class="flex items-center">
<span>{{ manga.title }}</span>
<span class="text-2xl text-gray-500 ml-2">({{ manga.publicationYear }})</span>
</div>
<a href="{{ path('app_manga_show', { 'mangaSlug': manga.slug }) }}"
class="text-gray-400 hover:text-gray-500">
<i class="fas fa-external-link-alt"></i>
</a>
</div>
<a href="{{ path('app_manga_show', { 'mangaSlug': manga.slug }) }}"
class="text-gray-400 hover:text-gray-500">
<i class="fas fa-external-link-alt"></i>
</a>
</div>
{% for genre in manga.genres %}
<span
class="bg-gray-200 text-gray-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
{% for genre in manga.genres %}
<span
class="bg-gray-200 text-gray-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
{{ genre }}
</span>
{% endfor %}
</div>
<div class="mb-2">
<p class="text-gray-700 text-sm">{{ manga.description|truncate(250) }}</p>
</div>
<div class="flex items-center">
{% endfor %}
</div>
<div class="mb-2">
<p class="text-gray-700 text-sm">{{ manga.description|truncate(250) }}</p>
</div>
<div class="flex items-center">
<span class="text-gray-600 text-sm mr-2">
<i class="fas fa-star text-yellow-500"></i>
{{ manga.rating }}
</span>
</div>
</div>
</div>
<twig:Modal
openTrigger="openAddMangaModal{{ loop.index }}"
closeTrigger="closeAddMangaModal{{ loop.index }}"
title="Add Manga"
modalId="manga-modal-{{ loop.index }}"
>
{% block content %}
<form id="manga-{{ loop.index }}" action="{{ path('app_manga_add') }}" method="POST">
<input type="hidden" name="title" value="{{ manga.title }}">
<input type="hidden" name="slug" value="{{ manga.slug }}">
<input type="hidden" name="description" value="{{ manga.description }}">
<input type="hidden" name="imageUrl" value="{{ manga.imageUrl }}">
<input type="hidden" name="status" value="{{ manga.status }}">
<input type="hidden" name="genres" value="{{ manga.genres|join(',') }}">
<input type="hidden" name="author" value="{{ manga.author }}">
<input type="hidden" name="publicationYear" value="{{ manga.publicationYear }}">
<input type="hidden" name="rating" value="{{ manga.rating }}">
<input type="hidden" name="externalId" value="{{ manga.externalId }}">
<div class="flex justify-between">
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}"
alt="{{ manga.title }}"
class="img-fluid mb-2"
style="width: 150px; height: 220px;"
>
<div class="ml-4">
<p>{{ manga.description|truncate(250) }}</p>
<p><strong>Année de publication:</strong> {{ manga.publicationYear }}</p>
<p><strong>Genres:</strong> {{ manga.genres|join(', ') }}</p>
<p><strong>Note:</strong> {{ manga.rating }}</p>
</div>
</div>
</form>
{% endblock %}
{% block footer %}
<button type="button" data-action="modal#close" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
{{ component('LoadingButton', {
text: 'Add ' ~ manga.title,
type: 'submit',
form: 'manga-' ~ loop.index,
color: 'green'
}) }}
{% endblock %}
</twig:Modal>
</div>
{{ component('NewMangaForm', {manga: manga, index: loop.index}) }}
{% endfor %}
</div>
{% endif %}