diff --git a/src/Controller/EntryController.php b/src/Controller/EntryController.php index 36f464c2d024146d744d1a8d9095e5661b2adbaa..de5d4c444b39b80cb595e7d123e99c4ac5e07ba8 100644 --- a/src/Controller/EntryController.php +++ b/src/Controller/EntryController.php @@ -83,6 +83,10 @@ class EntryController extends AppBaseController $this->addFlash('danger', reset($message) ?? 'Requête terminée'); } + if ($backUrl = $request->get('backUrl')) { + return $this->redirect($backUrl); + } + return $this->redirectToRoute('app_entry_show', ['id' => $entry->getId()]); } diff --git a/src/Repository/EntryRepository.php b/src/Repository/EntryRepository.php index 309ca7f71227496e7ce0181aeb1cd2f5cb21cf74..8b90a29c51b30099bee8969514dd39978b7b6509 100644 --- a/src/Repository/EntryRepository.php +++ b/src/Repository/EntryRepository.php @@ -129,7 +129,7 @@ class EntryRepository extends ServiceEntityRepository return $this->createQueryBuilder('e') ->andWhere('e.lexicon = :lexicon') ->setParameter('lexicon', $lexicon) - ->andWhere('e.updatedAt >= :date') + ->andWhere('e.updatedAt >= :date AND e.updatedAt != e.createdAt') ->setParameter('date', $date) ->getQuery() ->getResult() diff --git a/templates/home.html.twig b/templates/home.html.twig index 743aeb4c6119c97c8965d0f00f386fef40a5d7a7..9d43165a5b96c5c23770bce56d92cca1f04c7afe 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -10,7 +10,7 @@ <div class="d-inline-block text-center" id="appLinksZone"> <i class="fa fa-gamepad fa-4x"></i> - <br>MagicWorld + <br>MagicWord </div> <div class="text-center"> @@ -37,7 +37,7 @@ {% for lexicon in app.user.myLexicons %} {% if lexicon.masterGroup %} <div class=" d-flex justify-content-between align-items-start py-2"> - <a href="{{ path('app_lexicon_show', {id: app.user.lexicon.id}) }}">{{ lexicon|badge }} {{ "Lexique du groupe"|trans }} « {{ lexicon }} »</a> + <a href="{{ path('app_lexicon_show', {id: lexicon.id}) }}">{{ lexicon|badge }} {{ "Lexique du groupe"|trans }} « {{ lexicon }} »</a> <span>{{ lexicon_manager.entriesNb(lexicon) }}</span> </div> {% endif %} @@ -82,7 +82,21 @@ <div class="col"> <h1 class="text-center">{{ "Bonjour"|trans }} {{ app.user }}</h1> - <h1 class="mt-5">{{ "Mot du jour"|trans }}</h1> + <div class="mt-5 d-flex justify-content-between align-items-center"> + <h1>{{ "Mot du jour"|trans }}</h1> + {% if entry %} + <div class="dropdown me-1"> + <a title="{{ "Ajouter à un lexique"|trans }}" href="#" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-2x fa-plus-circle text-success"></i></a> + <ul class="dropdown-menu"> + {% for lexicon in app.user.myLexicons %} + <li><a class="dropdown-item" href="{{ path('app_entry_copy', {id: entry.id, lexiconId: lexicon.id, backUrl: path('app_lexicon_show', {id: lexicon.id})}) }}"> + {{ "Copier le mot dans le lexique"|trans }} {{ lexicon }} + </a></li> + {% endfor %} + </ul> + </div> + {% endif %} + </div> <div class="card mt-3"> <div class="card-body bg-pink"> {% if entry %}