Compare commits

..

5 Commits

Author SHA1 Message Date
85b5c6eb91 - Ajout Entity Avis
- Déplacement js dans le dossier public
2025-02-13 23:12:57 +01:00
da9e7057bc - Ajout d'une image par défaut lorsqu'il n'y en a aucune. 2025-02-13 22:33:27 +01:00
918c6fe6dc - Ajout de la favicon 2025-01-30 16:22:16 +01:00
e624949fc3 - Ajout de la favicon 2025-01-30 16:21:36 +01:00
b0bd392ce3 -Ajout des colonnes catégories et edition 2025-01-30 15:37:44 +01:00
9 changed files with 65 additions and 41 deletions

View File

@ -1,28 +0,0 @@
document.addEventListener('DOMContentLoaded', () => {
const datas = {{ datas | tojson }};
datas.items.forEach((book, index) => {
const openModalBtn = document.getElementById(`openModalBtn-${index + 1}`);
const closeModalSvg = document.getElementById(`closeModalSvg-${index + 1}`);
const closeModalBtn = document.getElementById(`closeModalBtn-${index + 1}`);
const modal = document.getElementById(`myModal-${index + 1}`);
if (openModalBtn) {
openModalBtn.addEventListener('click', () => {
modal.classList.remove('hidden');
});
}
if (closeModalSvg) {
closeModalSvg.addEventListener('click', () => {
modal.classList.add('hidden');
});
}
if (closeModalBtn) {
closeModalBtn.addEventListener('click', () => {
modal.classList.add('hidden');
});
}
});
});

BIN
public/img/logo-cropped.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -47,6 +47,9 @@ class APISearchController extends AbstractController
$description = $data['description'] ?? '';
$date = $data['date'] ?? '';
$pages = $data['pages'] ?? '';
$edition = $data['edition'] ?? '';
$categorie = $data['categorie'] ?? '';
$favoris = new Favoris();
$user = $this->getUser();
@ -59,6 +62,8 @@ class APISearchController extends AbstractController
$favoris->setPublication($date);
$favoris->setPages($pages);
$favoris->setPublication($date);
$favoris->setEdition($edition);
$favoris->setCategorie($categorie);
$favorisRepository->addFavoris($favoris);

View File

@ -66,6 +66,7 @@ class RegistrationController extends AbstractController
$this->entityManager->flush();
$this->addFlash('success', 'Votre compte a été créé avec succès !');
return $this->redirectToRoute('home');
}
}

View File

@ -39,9 +39,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Favoris::class)]
private Collection $favoris;
#[ORM\OneToMany(mappedBy: 'id_user', targetEntity: Avis::class)]
private Collection $avis;
public function __construct()
{
$this->favoris = new ArrayCollection();
$this->avis = new ArrayCollection();
}
@ -169,4 +173,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
/**
* @return Collection<int, Avis>
*/
public function getAvis(): Collection
{
return $this->avis;
}
public function addAvi(Avis $avi): static
{
if (!$this->avis->contains($avi)) {
$this->avis->add($avi);
$avi->setIdUser($this);
}
return $this;
}
public function removeAvi(Avis $avi): static
{
if ($this->avis->removeElement($avi)) {
// set the owning side to null (unless already changed)
if ($avi->getIdUser() === $this) {
$avi->setIdUser(null);
}
}
return $this;
}
}

View File

@ -170,6 +170,7 @@
},
"files": [
"assets/app.js",
"assets/js/modal.js",
"assets/styles/app.css",
"config/packages/webpack_encore.yaml",
"package.json",

View File

@ -24,12 +24,15 @@
{% endif %}
</div>
<div class="flex">
<div class="flex flex-row w-1/4">
{% if book.volumeInfo.imageLinks is defined and book.volumeInfo.imageLinks.smallThumbnail is defined %}
<img src="{{ book.volumeInfo.imageLinks.smallThumbnail }}" class="p-2">
{% endif %}
</div>
<div class="w-9/12">
<div class="flex flex-row w-1/4">
{% if book.volumeInfo.imageLinks is defined and book.volumeInfo.imageLinks.smallThumbnail is defined %}
<img src="{{ book.volumeInfo.imageLinks.smallThumbnail }}" class="p-2 w-[200px] h-[250] object-cover">
{% else %}
<img src="https://fakeimg.pl/550x750?text=no+cover" class="p-2 object-cover">
{% endif %}
</div>
<div class="w-9/12">
{% if book.volumeInfo.publisher is defined %}
<p class="p-2 italic font-bold">Aux éditions :
<span class="font-normal">{{ book.volumeInfo.publisher }}</span>
@ -79,11 +82,13 @@
class="like-button absolute top-2 right-2 w-6 h-6 cursor-pointer transition-colors duration-300"
data-id-google="{{ book.id }}"
data-liked="{{ isLiked ? 'true' : 'false' }}"
data-edition="{{ book.volumeInfo.publisher | default('') }}"
data-categorie="{{ book.volumeInfo.categories is defined ? book.volumeInfo.categories | join(', ') : '' }}"
data-title="{{ book.volumeInfo.title | default('Titre non disponible') }}"
data-authors="{{ book.volumeInfo.authors is defined ? book.volumeInfo.authors | join(', ') : '' }}"
data-images="{{ book.volumeInfo.imageLinks.smallThumbnail is defined ? book.volumeInfo.imageLinks.smallThumbnail : '' }}"
data-description="{{ book.volumeInfo.description | raw | default('Description non disponible') }}"
data-date="{{ book.volumeInfo.publishedDate | default('Date non disponible') }}"
data-description="{{ book.volumeInfo.description is defined and book.volumeInfo.description is not empty ? book.volumeInfo.description | raw : '' }}"
data-date="{{ book.volumeInfo.publishedDate | default('') }}"
data-pages="{{ book.volumeInfo.pageCount | default('0') }}">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"/>
</svg>
@ -190,7 +195,7 @@
<script>
function toggleLike(idGoogle, liked, element, bookDetails) {
const url = liked
const url = liked
? "{{ path('unlike', {'idGoogle': 'PLACEHOLDER'}) }}".replace('PLACEHOLDER', idGoogle)
: "{{ path('like', {'idGoogle': 'PLACEHOLDER'}) }}".replace('PLACEHOLDER', idGoogle);
@ -227,7 +232,9 @@ document.querySelectorAll('.like-button').forEach(button => {
images: this.dataset.images,
description: this.dataset.description,
date: this.dataset.date,
pages: this.dataset.pages
pages: this.dataset.pages,
edition: this.dataset.edition,
categorie: this.dataset.categorie
};
toggleLike(idGoogle, liked, this, bookDetails);
@ -261,6 +268,8 @@ document.querySelectorAll('.like-button').forEach(button => {
{% endfor %}
});
</script>
{% endblock %}

View File

@ -2,9 +2,11 @@
<div id="myModal-{{ loop.index }}" class="fixed inset-0 bg-black bg-opacity-50 flex justify-center items-center hidden z-50">
<div class="relative bg-white p-6 rounded-lg w-1/3 max-h-screen overflow-y-auto">
<div class="flex mx-auto flex-row w-1/4">
<div class="flex flex-row w-1/4">
{% if book.volumeInfo.imageLinks is defined and book.volumeInfo.imageLinks.smallThumbnail is defined %}
<img src="{{ book.volumeInfo.imageLinks.smallThumbnail }}" class="p-2">
<img src="{{ book.volumeInfo.imageLinks.smallThumbnail }}" class="p-2 w-[200px] h-[250] object-cover">
{% else %}
<img src="https://fakeimg.pl/550x750?text=no+cover" class="p-2 object-cover">
{% endif %}
</div>
<svg id="closeModalSvg-{{ loop.index }}" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"

View File

@ -7,7 +7,7 @@
{% block title %}Bienvenue!
{% endblock %}
</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
<link rel="icon" href="{{ asset('img/logo-cropped.ico') }}" type="image/x-icon"/>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}