From bd58cced59b5dc5da9b72e400ebbcedfba91b12e Mon Sep 17 00:00:00 2001 From: pfleu <fleutotp@gmail.com> Date: Fri, 26 May 2023 08:57:37 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20visibilit=C3=A9=20labels.=20Fix=20page=20?= =?UTF-8?q?entr=C3=A9e=20du=20lexique=20Z=C3=A9ro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/EntryController.php | 1 - src/Controller/WiktionnaryController.php | 2 ++ src/Entity/Label.php | 6 ++++++ src/Repository/LabelRepository.php | 4 +++- templates/entry/_entryAttributes.html.twig | 2 +- templates/entry/show.html.twig | 5 +++-- templates/home.html.twig | 3 +++ templates/label/_labelBadge.html.twig | 2 +- 8 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Controller/EntryController.php b/src/Controller/EntryController.php index da121c1..90d0e04 100644 --- a/src/Controller/EntryController.php +++ b/src/Controller/EntryController.php @@ -30,7 +30,6 @@ class EntryController extends AppBaseController return $this->render('entry/show.html.twig', array( 'entry' => $entry, - 'wiktionnaryLexicon' => false, )); } diff --git a/src/Controller/WiktionnaryController.php b/src/Controller/WiktionnaryController.php index 78a8563..c04f9c5 100644 --- a/src/Controller/WiktionnaryController.php +++ b/src/Controller/WiktionnaryController.php @@ -22,6 +22,8 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; class WiktionnaryController extends AppBaseController { /** + * PAS UTILISÉ + * * @Route("/{id}/show", name="app_wiktionnary_show", requirements={"id" = "\d+"}) */ public function show(LabelManager $labelManager, Request $request, Entry $entry) diff --git a/src/Entity/Label.php b/src/Entity/Label.php index e3ae077..cadacbc 100644 --- a/src/Entity/Label.php +++ b/src/Entity/Label.php @@ -30,6 +30,12 @@ class Label self::LABEL_CATEGORY_MILESTONE => self::LABEL_CATEGORY_MILESTONE, ]; + const COMMON_LABEL_LIST_CATEGORIES = [ + self::LABEL_CATEGORY_INSTITUTIONAL => self::LABEL_CATEGORY_INSTITUTIONAL, + self::LABEL_CATEGORY_GENERAL => self::LABEL_CATEGORY_GENERAL, + self::LABEL_CATEGORY_MILESTONE => self::LABEL_CATEGORY_MILESTONE, + ]; + const REQUIREMENTS_LABEL_CATEGORY = self::LABEL_CATEGORY_INSTITUTIONAL .'|'. self::LABEL_CATEGORY_MORPHOLOGICAL .'|'. diff --git a/src/Repository/LabelRepository.php b/src/Repository/LabelRepository.php index 9d731f8..880cd20 100644 --- a/src/Repository/LabelRepository.php +++ b/src/Repository/LabelRepository.php @@ -115,10 +115,12 @@ class LabelRepository extends ServiceEntityRepository $qb = $this->createQueryBuilder('l') ->andWhere('l.master != :personal OR l.user = :user') ->andWhere('l.category != :milestone OR l.user = :user') + ->andWhere('l.category IN (:commonLabelCategories)') ->setParameter('milestone', Label::LABEL_CATEGORY_MILESTONE) ->setParameter('personal', Label::MASTER_PERSONAL) + ->setParameter('commonLabelCategories', Label::COMMON_LABEL_LIST_CATEGORIES) ->setParameter('user', $user) - ->orderBy('l.createdAt', 'DESC') + ->orderBy('l.updatedAt', 'DESC') ; return $qb; diff --git a/templates/entry/_entryAttributes.html.twig b/templates/entry/_entryAttributes.html.twig index 8edfe82..28f6ae8 100644 --- a/templates/entry/_entryAttributes.html.twig +++ b/templates/entry/_entryAttributes.html.twig @@ -1 +1 @@ -<h3>{{ entry }}</h3> \ No newline at end of file +{{ dump(entry.attributes) }} \ No newline at end of file diff --git a/templates/entry/show.html.twig b/templates/entry/show.html.twig index 9fb7e70..71ffa1f 100644 --- a/templates/entry/show.html.twig +++ b/templates/entry/show.html.twig @@ -19,7 +19,7 @@ </h1> {% else %} <h1> - {% if not wiktionnaryLexicon %} + {% if not entry.lexicon.zero %} <a href="{{ path('app_lexicon_show', {id: entry.lexicon.id}) }}" class="btn btn-dark"><i class="bi bi-arrow-90deg-left"></i></a> {% endif %} {{ entry|capitalize }} @@ -35,12 +35,13 @@ {% if not entry.lexicon.newWords %} {% include "entry/_lexiconsTabs.html.twig" %} - <div id="tabContent" class="{{ wiktionnaryLexicon ? 'tab-wiktionnary' }}"> + <div id="tabContent" class="{{ entry.lexicon.zero ? 'tab-wiktionnary' }}"> <div class="row"> <div class="col-sm-6"> {% include "entry/_entryLabels.html.twig" %} + {% include "entry/_entryAttributes.html.twig" %} </div> </div> diff --git a/templates/home.html.twig b/templates/home.html.twig index 7128250..7bfce71 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -83,6 +83,9 @@ <h1 class="mt-5">{{ "Mot du jour"|trans }}</h1> <div class="card mt-3"> <div class="card-body bg-pink"> + <a href="{{ path('app_entry_show', {id: entry.id}) }}"> + <h3>{{ entry }}</h3> + </a> {% include "entry/_entryAttributes.html.twig" %} </div> </div> diff --git a/templates/label/_labelBadge.html.twig b/templates/label/_labelBadge.html.twig index 31a2744..a70ab0e 100644 --- a/templates/label/_labelBadge.html.twig +++ b/templates/label/_labelBadge.html.twig @@ -1,5 +1,5 @@ <div class="badge rounded-pill {{ label.isMilestone ? 'badge-milestone'}} position-relative text-black {{ label|labelClass }}" style="margin-right: 5px;" - title="{{ label.description }}"> + title="{{ label.description }}. Updated: {{ label.updatedAt|date('d/m/Y') }}"> {{ label }} {% if label.isMilestone %}<br>{{ label.getMilestone|date('d/m/Y') }}{% endif %} {% if showHeadwordsCounter|default(false) %} -- GitLab