Added:
- Refactor MangaScraperService (not used everywhere now) - Added JavascriptScraper.php - Added alternatives slugs in Manga.php - Improvement in manga edit form
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
||||
|
||||
{# Modal panel #}
|
||||
<div class="inline-block align-bottom bg-white rounded-sm text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
|
||||
<div class="inline-block align-bottom bg-white rounded-sm text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle {{ modalClass|default('sm:max-w-lg') }} sm:w-full">
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
|
||||
{{ title }}
|
||||
|
||||
@@ -55,33 +55,89 @@
|
||||
openTrigger="openEditModal"
|
||||
closeTrigger="closeEditModal"
|
||||
title="Edit Manga"
|
||||
modalClass="w-full max-w-4xl"
|
||||
>
|
||||
{% block content %}
|
||||
<form id="editForm" method="post" action="">
|
||||
<div class="mb-4">
|
||||
<label for="title" class="block text-gray-700 text-sm font-bold mb-2">Title:</label>
|
||||
<input type="text" id="title" name="title" value="{{ manga.title }}"
|
||||
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
{{ form_start(form, {'action': path('app_manga_edit', {'id': manga.id}), 'attr': {'id': 'editForm', 'data-turbo-form': 'true'}}) }}
|
||||
{% do form.alternativeSlugs.setRendered() %}
|
||||
|
||||
<div class="space-y-4 overflow-y-auto px-4">
|
||||
{{ form_row(form.title, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
{{ form_row(form.slug, {
|
||||
'label_attr': {'class': 'block text-sm font-medium text-gray-700'},
|
||||
'row_attr': {'class': 'mt-1'},
|
||||
'attr': {
|
||||
'class': 'w-full px-3 py-2 bg-gray-100 border border-gray-300 rounded-md focus:outline-none text-gray-500',
|
||||
'readonly': true
|
||||
}
|
||||
}) }}
|
||||
{{ form_row(form.publicationYear, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
{{ form_row(form.description, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
{{ form_row(form.author, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
{{ form_row(form.status, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
{{ form_row(form.rating, {'label_attr': {'class': 'block text-sm font-medium text-gray-700'}, 'row_attr': {'class': 'mt-1'}}) }}
|
||||
|
||||
<div {{ stimulus_controller('collection') }}>
|
||||
<label class="block text-sm font-medium text-gray-700">Slugs alternatifs</label>
|
||||
<div data-collection-target="container" class="grid grid-cols-4 gap-2 mt-1">
|
||||
{% for slug in form.alternativeSlugs %}
|
||||
<div class="inline-flex items-center bg-gray-100 rounded-full px-3 py-1 text-sm collection-item">
|
||||
{{ form_widget(slug, {'attr': {'class': 'bg-transparent border-none focus:outline-none focus:border-b focus:border-green-500 p-0 w-full'}}) }}
|
||||
<button type="button" data-action="collection#remove" class="ml-2 text-gray-500 hover:text-green-500 flex-shrink-0">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="button" data-action="collection#add" class="mt-2 text-sm text-green-500 hover:text-green-700">
|
||||
+ Ajouter un slug alternatif
|
||||
</button>
|
||||
<template data-collection-target="template">
|
||||
<div class="inline-flex items-center bg-gray-100 rounded-full px-3 py-1 text-sm collection-item">
|
||||
{{ form_widget(form.alternativeSlugs.vars.prototype, {'attr': {'class': 'bg-transparent border-none focus:outline-none focus:border-b focus:border-green-500 p-0 w-full'}}) }}
|
||||
<button type="button" data-action="collection#remove" class="ml-2 text-gray-500 hover:text-green-500 flex-shrink-0">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="description"
|
||||
class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
|
||||
<textarea id="description" name="description"
|
||||
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
|
||||
rows="3">{{ manga.description }}</textarea>
|
||||
|
||||
<div {{ stimulus_controller('collection') }}>
|
||||
<label class="block text-sm font-medium text-gray-700">{{ form_label(form.genres) }}</label>
|
||||
<div data-collection-target="container" class="grid grid-cols-4 gap-2 mt-1">
|
||||
{% for genre in form.genres %}
|
||||
<div class="inline-flex items-center bg-gray-100 rounded-full px-3 py-1 text-sm collection-item">
|
||||
{{ form_widget(genre, {'attr': {'class': 'bg-transparent border-none focus:outline-none focus:border-b focus:border-green-500 p-0 w-full'}}) }}
|
||||
<button type="button" data-action="collection#remove" class="ml-2 text-gray-500 hover:text-green-500 flex-shrink-0">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="button" data-action="collection#add" class="mt-2 text-sm text-green-500 hover:text-green-700">
|
||||
+ Ajouter un genre
|
||||
</button>
|
||||
<template data-collection-target="template">
|
||||
<div class="inline-flex items-center bg-gray-100 rounded-full px-3 py-1 text-sm collection-item">
|
||||
{{ form_widget(form.genres.vars.prototype, {'attr': {'class': 'bg-transparent border-none focus:outline-none focus:border-b focus:border-green-500 p-0 w-full'}}) }}
|
||||
<button type="button" data-action="collection#remove" class="ml-2 text-gray-500 hover:text-green-500 flex-shrink-0">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
{# Ajoutez d'autres champs selon vos besoins #}
|
||||
</form>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
{% block footer %}
|
||||
<button type="submit" form="editForm"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
||||
Save
|
||||
</button>
|
||||
<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>
|
||||
<button type="submit" form="editForm"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:ml-3 sm:w-auto sm:text-sm">
|
||||
Save
|
||||
</button>
|
||||
{% endblock %}
|
||||
</twig:Modal>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user