From 43f7d900f3afe930dcd3a04ae1397a925d7d9f69 Mon Sep 17 00:00:00 2001 From: Enzo Simonnet <enzosim@laposte.net> Date: Thu, 14 Dec 2023 16:31:16 +0100 Subject: [PATCH] oulala --- src/Command/AccountCreationTeacherCommand.php | 2 +- src/Command/BootstrapCommand.php | 2 +- src/Controller/RegistrationController.php | 2 +- src/Entity/User.php | 22 ++++++++----------- templates/dashboard/dashboard.html.twig | 3 +-- templates/successes.html.twig | 2 +- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/Command/AccountCreationTeacherCommand.php b/src/Command/AccountCreationTeacherCommand.php index 3a44190..d1a94e2 100644 --- a/src/Command/AccountCreationTeacherCommand.php +++ b/src/Command/AccountCreationTeacherCommand.php @@ -75,7 +75,7 @@ class AccountCreationTeacherCommand extends Command - $user = new User($this->translator); + $user = new User(); $user->setPseudo($username); $user->setEmail($email); $user->setUuid(new UuidV1()); diff --git a/src/Command/BootstrapCommand.php b/src/Command/BootstrapCommand.php index 43da109..24f301c 100644 --- a/src/Command/BootstrapCommand.php +++ b/src/Command/BootstrapCommand.php @@ -63,7 +63,7 @@ class BootstrapCommand extends Command $redirectUris = explode(',', $input->getOption('redirect-uris')); // Create the user - $user = new User($this->translator); + $user = new User(); $user->setEmail($email); $user->setPassword($this->passwordHasher->hashPassword($user, $password)); $user->setRoles(['ROLE_SUPER_ADMIN']); diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index ea91516..303907f 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -36,7 +36,7 @@ class RegistrationController extends AbstractController VerifyEmailHelperInterface $verifyEmailHelper, MailerInterface $mailer): Response { - $user = new User($this->translator); + $user = new User(); $form = $this->createForm(RegistrationFormType::class, $user); $form->handleRequest($request); diff --git a/src/Entity/User.php b/src/Entity/User.php index f36c198..1b501a1 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -16,7 +16,6 @@ use Symfony\Component\Uid\UuidV1; use Symfony\Component\Validator\Constraints as Assert; use Vich\UploaderBundle\Mapping\Annotation as Vich; use Symfony\Component\Serializer\Annotation\Ignore; -use Symfony\Contracts\Translation\TranslatorInterface; /** * @ORM\Entity(repositoryClass=UserRepository::class) @@ -270,14 +269,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface */ private $lastDailyQuestUpdate; - private $translator; - public function __toString() { return $this->getPseudo(); } - public function __construct(TranslatorInterface $translator) + public function __construct() { $this->oAuth2UserConsents = new ArrayCollection(); $this->uuid = new UuidV1(); @@ -301,7 +298,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $this->lexicons = new ArrayCollection(); $this->userPoints = 0; $this->successes = new ArrayCollection(); - $this->translator = $translator; $this->initializeSuccesses(); $this->dailyQuestStrike = 0; } @@ -315,7 +311,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 10, 25, 50, 100]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots ajoutés par vous dans tous vos lexiques')); + $success->setExplanation('Nombre de mots ajoutés par vous dans tous vos lexiques'); $success->setColors(['#181893', '#E5E8F9']); // $success->setIcon('assets/images/success_icons/vocabulord.png'); // Set the icon attribute // Add the Success entity to the user's $successes collection @@ -327,7 +323,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 10, 25, 50, 100]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots auquel vous avez ajouté au moins un label')); + $success->setExplanation('Nombre de mots auquel vous avez ajouté au moins un label'); $success->setColors(['#E52322', '#FFE5D9']); // $success->setIcon('assets/images/success_icons/labelliciste.png'); // Set the icon attribute $this->successes->add($success); @@ -338,7 +334,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 5, 25, 50, 100, 250]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre total de consultations de toutes vos entrées')); + $success->setExplanation('Nombre total de consultations de toutes vos entrées'); $success->setColors(['#93184A', '#FFE1EF']); // $success->setIcon('assets/images/success_icons/gardien_du_savoir.png'); // Set the icon attribute $this->successes->add($success); @@ -349,7 +345,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 2, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de jours consécutifs où vous avez réussi la quête journalière')); + $success->setExplanation('Nombre de jours consécutifs où vous avez réussi la quête journalière'); $success->setColors(['#412666', '#E7D5E9']); // $success->setIcon('assets/images/success_icons/maitre_du_temps.png'); // Set the icon attribute $this->successes->add($success); @@ -360,7 +356,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots ajoutés par vous à un label public')); + $success->setExplanation('Nombre de mots ajoutés par vous à un label public'); $success->setColors(['#009FE3', '#D0EBFC']); // $success->setIcon('assets/images/success_icons/altruiste.png'); // Set the icon attribute $this->successes->add($success); @@ -371,7 +367,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans("Nombre d'entrées modifiées par vous dans vos lexiques de groupe")); + $success->setExplanation("Nombre d'entrées modifiées par vous dans vos lexiques de groupe"); $success->setColors(['#E9580C', '#FFE8D9']); // $success->setIcon('assets/images/success_icons/acolyte_anonyme.png'); // Set the icon attribute $this->successes->add($success); @@ -382,7 +378,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de messages écrits dans les discussions de groupe')); + $success->setExplanation('Nombre de messages écrits dans les discussions de groupe'); $success->setColors(['#05993C', '#EAF3E3']); // $success->setIcon('assets/images/success_icons/messager.png'); // Set the icon attribute $this->successes->add($success); @@ -393,7 +389,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de commentaires écrits dans les entrées')); + $success->setExplanation('Nombre de commentaires écrits dans les entrées'); $success->setColors(['#F6A600', '#FBF6DB']); // $success->setIcon('assets/images/success_icons/commentateur_sportif.png'); // Set the icon attribute $this->successes->add($success); diff --git a/templates/dashboard/dashboard.html.twig b/templates/dashboard/dashboard.html.twig index 1c97c00..825ea43 100644 --- a/templates/dashboard/dashboard.html.twig +++ b/templates/dashboard/dashboard.html.twig @@ -60,8 +60,7 @@ {% endfor %} </div> </div> - {% set counter = counter + 1 %} - {% endif %} + </div> {% endfor %} </div> </div> diff --git a/templates/successes.html.twig b/templates/successes.html.twig index 644b2c0..482f946 100644 --- a/templates/successes.html.twig +++ b/templates/successes.html.twig @@ -43,7 +43,7 @@ {# <img src="{{ asset(successData.icon) }}" alt="{{ successData.successName }}" class="success-icon-img">#} </div> <div class="success-info"> - <div class="success-title" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ successData.explanation }}"> + <div class="success-title" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ successData.explanation |trans}}"> {{ successData.successName|trans }} </div> <div class="success-progress"> -- GitLab