From 4dc872238a61f33c886c423c5812cc578b3b1cdc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 26 Feb 2016 13:59:08 +0100 Subject: [PATCH] Rename CommentBundle with AnnotationBundle --- app/AppKernel.php | 2 +- app/config/routing.yml | 4 +- docs/en/user/annotations.rst | 12 +-- docs/fr/user/annotations.rst | 20 ++-- .../WallabagAnnotationController.php} | 62 ++++++------ .../DataFixtures/ORM/LoadAnnotationData.php | 45 +++++++++ .../DependencyInjection/Configuration.php | 4 +- .../WallabagAnnotationExtension.php} | 4 +- .../Entity/Annotation.php} | 24 ++--- .../Repository/AnnotationRepository.php | 91 ++++++++++++++++++ .../Resources/config/routing_annotations.yml | 4 + .../Controller/AnnotationControllerTest.php} | 50 +++++----- .../Tests/WallabagAnnotationTestCase.php} | 4 +- .../WallabagAnnotationBundle.php | 9 ++ .../DataFixtures/ORM/LoadCommentData.php | 45 --------- .../Repository/CommentRepository.php | 94 ------------------- .../Resources/config/routing_comments.yml | 4 - .../CommentBundle/WallabagCommentBundle.php | 9 -- src/Wallabag/CoreBundle/Entity/Entry.php | 18 ++-- .../Resources/translations/messages.fr.yml | 2 +- .../views/themes/baggy/Entry/entry.html.twig | 8 +- .../themes/material/Entry/entry.html.twig | 8 +- 22 files changed, 260 insertions(+), 263 deletions(-) rename src/Wallabag/{CommentBundle/Controller/WallabagCommentController.php => AnnotationBundle/Controller/WallabagAnnotationController.php} (57%) create mode 100644 src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php rename src/Wallabag/{CommentBundle => AnnotationBundle}/DependencyInjection/Configuration.php (74%) rename src/Wallabag/{CommentBundle/DependencyInjection/WallabagCommentExtension.php => AnnotationBundle/DependencyInjection/WallabagAnnotationExtension.php} (77%) rename src/Wallabag/{CommentBundle/Entity/Comment.php => AnnotationBundle/Entity/Annotation.php} (91%) create mode 100644 src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php create mode 100644 src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml rename src/Wallabag/{CommentBundle/Tests/Controller/CommentControllerTest.php => AnnotationBundle/Tests/Controller/AnnotationControllerTest.php} (55%) rename src/Wallabag/{CommentBundle/Tests/WallabagCommentTestCase.php => AnnotationBundle/Tests/WallabagAnnotationTestCase.php} (94%) create mode 100644 src/Wallabag/AnnotationBundle/WallabagAnnotationBundle.php delete mode 100644 src/Wallabag/CommentBundle/DataFixtures/ORM/LoadCommentData.php delete mode 100644 src/Wallabag/CommentBundle/Repository/CommentRepository.php delete mode 100644 src/Wallabag/CommentBundle/Resources/config/routing_comments.yml delete mode 100644 src/Wallabag/CommentBundle/WallabagCommentBundle.php diff --git a/app/AppKernel.php b/app/AppKernel.php index 1f2d4ad4..30ac7463 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -35,7 +35,7 @@ class AppKernel extends Kernel new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Craue\ConfigBundle\CraueConfigBundle(), new Lexik\Bundle\MaintenanceBundle\LexikMaintenanceBundle(), - new Wallabag\CommentBundle\WallabagCommentBundle(), + new Wallabag\AnnotationBundle\WallabagAnnotationBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/config/routing.yml b/app/config/routing.yml index 8fbcb643..6a6aa6ac 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,6 +1,6 @@ -wallabag_comment: +wallabag_annotation: type : rest - resource: "@WallabagCommentBundle/Resources/config/routing_comments.yml" + resource: "@WallabagAnnotationBundle/Resources/config/routing_annotations.yml" wallabag_import: resource: "@WallabagImportBundle/Controller/" diff --git a/docs/en/user/annotations.rst b/docs/en/user/annotations.rst index d30b2c52..fab854aa 100644 --- a/docs/en/user/annotations.rst +++ b/docs/en/user/annotations.rst @@ -3,22 +3,22 @@ Annotations In each article you read, you can write annotations. It's easier to understand with some pictures. -Select the part of the article that you want to comment and click on the pencil: +Select the part of the article that you want to annotate and click on the pencil: .. image:: ../../img/user/annotations_1.png :alt: Select your text :align: center -Then, write your comment: +Then, write your annotation: .. image:: ../../img/user/annotations_2.png - :alt: Write your comment + :alt: Write your annotation :align: center -The text is now highlighted and you can read your comment if you move the mouse cursor over it. +The text is now highlighted and you can read your annotation if you move the mouse cursor over it. .. image:: ../../img/user/annotations_3.png - :alt: Read your comment + :alt: Read your annotation :align: center -You can create as many comments as you wish. +You can create as many annotations as you wish. diff --git a/docs/fr/user/annotations.rst b/docs/fr/user/annotations.rst index 8ba87e26..24585961 100644 --- a/docs/fr/user/annotations.rst +++ b/docs/fr/user/annotations.rst @@ -1,25 +1,25 @@ -Commentaires -============ +Annotations +=========== -Sur chaque article que vous lisez, vous pouvez écrire des commentaires. Puisqu'une image vaut mieux qu'un long discours, +Sur chaque article que vous lisez, vous pouvez écrire des annotations. Puisqu'une image vaut mieux qu'un long discours, voici ce que ça donne. -Sélectionnez la zone du texte que vous souhaitez commenter et cliquez sur le crayon : +Sélectionnez la zone du texte que vous souhaitez annoter et cliquez sur le crayon : .. image:: ../../img/user/annotations_1.png - :alt: Select your text + :alt: Sélectionnez votre texte :align: center -Ensuite, écrivez votre commentaire : +Ensuite, écrivez votre annotation : .. image:: ../../img/user/annotations_2.png - :alt: Write your comment + :alt: Écrivez votre annotation :align: center -Le texte est maintenant surligné et vous pouvez lire le commentaire en le survolant avec votre souris. +Le texte est maintenant surligné et vous pouvez lire le annotation en le survolant avec votre souris. .. image:: ../../img/user/annotations_3.png - :alt: Read your comment + :alt: Lisez votre annotation :align: center -Vous pouvez créer autant de commentaires que vous le souhaitez. +Vous pouvez créer autant de annotations que vous le souhaitez. diff --git a/src/Wallabag/CommentBundle/Controller/WallabagCommentController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php similarity index 57% rename from src/Wallabag/CommentBundle/Controller/WallabagCommentController.php rename to src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index be11f226..5f981eb5 100644 --- a/src/Wallabag/CommentBundle/Controller/WallabagCommentController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -1,19 +1,19 @@ getDoctrine() - ->getRepository('WallabagCommentBundle:Comment') - ->findCommentsByPageId($entry->getId(), $this->getUser()->getId()); - $total = count($commentRows); - $comments = array('total' => $total, 'rows' => $commentRows); + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); + $total = count($annotationRows); + $annotations = array('total' => $total, 'rows' => $annotationRows); - $json = $this->get('serializer')->serialize($comments, 'json'); + $json = $this->get('serializer')->serialize($annotations, 'json'); return $this->renderJsonResponse($json); } /** - * Creates a new comment. + * Creates a new annotation. * * @param Entry $entry * * @ApiDoc( * requirements={ * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"}, - * {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the comment"}, + * {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the annotation"}, * {"name"="text", "dataType"="string", "required"=true, "description"=""}, * } * ) @@ -58,75 +58,75 @@ class WallabagCommentController extends FOSRestController $em = $this->getDoctrine()->getManager(); - $comment = new Comment($this->getUser()); + $annotation = new Annotation($this->getUser()); - $comment->setText($data['text']); + $annotation->setText($data['text']); if (array_key_exists('quote', $data)) { - $comment->setQuote($data['quote']); + $annotation->setQuote($data['quote']); } if (array_key_exists('ranges', $data)) { - $comment->setRanges($data['ranges']); + $annotation->setRanges($data['ranges']); } - $comment->setEntry($entry); + $annotation->setEntry($entry); - $em->persist($comment); + $em->persist($annotation); $em->flush(); - $json = $this->get('serializer')->serialize($comment, 'json'); + $json = $this->get('serializer')->serialize($annotation, 'json'); return $this->renderJsonResponse($json); } /** - * Updates a comment. + * Updates an annotation. * * @ApiDoc( * requirements={ - * {"name"="comment", "dataType"="string", "requirement"="\w+", "description"="The comment ID"} + * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} * } * ) * - * @ParamConverter("comment", class="WallabagCommentBundle:Comment") + * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") * * @return Response */ - public function putAnnotationAction(Comment $comment, Request $request) + public function putAnnotationAction(Annotation $annotation, Request $request) { $data = json_decode($request->getContent(), true); if (!is_null($data['text'])) { - $comment->setText($data['text']); + $annotation->setText($data['text']); } $em = $this->getDoctrine()->getManager(); $em->flush(); - $json = $this->get('serializer')->serialize($comment, 'json'); + $json = $this->get('serializer')->serialize($annotation, 'json'); return $this->renderJsonResponse($json); } /** - * Removes a comment. + * Removes an annotation. * * @ApiDoc( * requirements={ - * {"name"="comment", "dataType"="string", "requirement"="\w+", "description"="The comment ID"} + * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} * } * ) * - * @ParamConverter("comment", class="WallabagCommentBundle:Comment") + * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") * * @return Response */ - public function deleteAnnotationAction(Comment $comment) + public function deleteAnnotationAction(Annotation $annotation) { $em = $this->getDoctrine()->getManager(); - $em->remove($comment); + $em->remove($annotation); $em->flush(); - $json = $this->get('serializer')->serialize($comment, 'json'); + $json = $this->get('serializer')->serialize($annotation, 'json'); return $this->renderJsonResponse($json); } diff --git a/src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php b/src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php new file mode 100644 index 00000000..20e07fa3 --- /dev/null +++ b/src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php @@ -0,0 +1,45 @@ +getReference('admin-user')); + $annotation1->setEntry($this->getReference('entry1')); + $annotation1->setText('This is my annotation /o/'); + $annotation1->setQuote('content'); + + $manager->persist($annotation1); + + $this->addReference('annotation1', $annotation1); + + $annotation2 = new Annotation($this->getReference('admin-user')); + $annotation2->setEntry($this->getReference('entry2')); + $annotation2->setText('This is my 2nd annotation /o/'); + $annotation2->setQuote('content'); + + $manager->persist($annotation2); + + $this->addReference('annotation2', $annotation2); + + $manager->flush(); + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 35; + } +} diff --git a/src/Wallabag/CommentBundle/DependencyInjection/Configuration.php b/src/Wallabag/AnnotationBundle/DependencyInjection/Configuration.php similarity index 74% rename from src/Wallabag/CommentBundle/DependencyInjection/Configuration.php rename to src/Wallabag/AnnotationBundle/DependencyInjection/Configuration.php index bc8d0615..5e4e4e9c 100644 --- a/src/Wallabag/CommentBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/AnnotationBundle/DependencyInjection/Configuration.php @@ -1,6 +1,6 @@ root('wallabag_comment'); + $rootNode = $treeBuilder->root('wallabag_annotation'); return $treeBuilder; } diff --git a/src/Wallabag/CommentBundle/DependencyInjection/WallabagCommentExtension.php b/src/Wallabag/AnnotationBundle/DependencyInjection/WallabagAnnotationExtension.php similarity index 77% rename from src/Wallabag/CommentBundle/DependencyInjection/WallabagCommentExtension.php rename to src/Wallabag/AnnotationBundle/DependencyInjection/WallabagAnnotationExtension.php index 6b05fa00..159576d6 100644 --- a/src/Wallabag/CommentBundle/DependencyInjection/WallabagCommentExtension.php +++ b/src/Wallabag/AnnotationBundle/DependencyInjection/WallabagAnnotationExtension.php @@ -1,11 +1,11 @@ entry = $entry; - $entry->setComment($this); + $entry->setAnnotation($this); return $this; } diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php new file mode 100644 index 00000000..c1c6e638 --- /dev/null +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -0,0 +1,91 @@ +createQueryBuilder('a') + ->leftJoin('a.user', 'u') + ->andWhere('u.id = :userId')->setParameter('userId', $userId) + ->orderBy('a.id', 'desc') + ; + } + + /** + * Retrieves all annotations for a user. + * + * @param int $userId + * + * @return QueryBuilder + */ + public function getBuilderForAllByUser($userId) + { + return $this + ->getBuilderByUser($userId) + ; + } + + /** + * Get annotation for this id. + * + * @param int $annotationId + * + * @return array + */ + public function findAnnotationById($annotationId) + { + return $this->createQueryBuilder('a') + ->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId) + ->getQuery()->getSingleResult() + ; + } + + /** + * Find annotations for entry id. + * + * @param int $entryId + * @param int $userId + * + * @return array + */ + public function findAnnotationsByPageId($entryId, $userId) + { + return $this->createQueryBuilder('a') + ->where('a.entry = :entryId')->setParameter('entryId', $entryId) + ->andwhere('a.user = :userId')->setParameter('userId', $userId) + ->getQuery()->getResult() + ; + } + + /** + * Find last annotation for a given entry id. Used only for tests. + * + * @param int $entryId + * + * @return array + */ + public function findLastAnnotationByPageId($entryId, $userId) + { + return $this->createQueryBuilder('a') + ->where('a.entry = :entryId')->setParameter('entryId', $entryId) + ->andwhere('a.user = :userId')->setParameter('userId', $userId) + ->orderBy('a.id', 'DESC') + ->setMaxResults(1) + ->getQuery() + ->getOneOrNullResult(); + } +} diff --git a/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml b/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml new file mode 100644 index 00000000..4f3a5c93 --- /dev/null +++ b/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml @@ -0,0 +1,4 @@ +annotations: + type: rest + resource: "WallabagAnnotationBundle:WallabagAnnotation" + name_prefix: annotations_ diff --git a/src/Wallabag/CommentBundle/Tests/Controller/CommentControllerTest.php b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php similarity index 55% rename from src/Wallabag/CommentBundle/Tests/Controller/CommentControllerTest.php rename to src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php index f8b2a56f..c0efe272 100644 --- a/src/Wallabag/CommentBundle/Tests/Controller/CommentControllerTest.php +++ b/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php @@ -1,31 +1,31 @@ client->getContainer() + $annotation = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCommentBundle:Comment') + ->getRepository('WallabagAnnotationBundle:Annotation') ->findOneBy(array('user' => 1)); - if (!$comment) { + if (!$annotation) { $this->markTestSkipped('No content found in db.'); } $this->logInAs('admin'); - $crawler = $this->client->request('GET', 'annotations/'.$comment->getEntry()->getId().'.json'); + $crawler = $this->client->request('GET', 'annotations/'.$annotation->getEntry()->getId().'.json'); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertEquals(1, $content['total']); - $this->assertEquals($comment->getText(), $content['rows'][0]['text']); + $this->assertEquals($annotation->getText(), $content['rows'][0]['text']); } - public function testSetcomment() + public function testSetAnnotation() { $this->logInAs('admin'); @@ -36,7 +36,7 @@ class CommentControllerTest extends WallabagCommentTestCase $headers = array('CONTENT_TYPE' => 'application/json'); $content = json_encode(array( - 'text' => 'my comment', + 'text' => 'my annotation', 'quote' => 'my quote', 'range' => '[{"start":"","startOffset":24,"end":"","endOffset":31}]', )); @@ -44,38 +44,38 @@ class CommentControllerTest extends WallabagCommentTestCase $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); - $comment = $this->client->getContainer() + $annotation = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCommentBundle:Comment') - ->findLastCommentByPageId($entry->getId(), 1); + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findLastAnnotationByPageId($entry->getId(), 1); - $this->assertEquals('my comment', $comment->getText()); + $this->assertEquals('my annotation', $annotation->getText()); } - public function testEditcomment() + public function testEditAnnotation() { - $comment = $this->client->getContainer() + $annotation = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCommentBundle:Comment') + ->getRepository('WallabagAnnotationBundle:Annotation') ->findOneBy(array('user' => 1)); $this->logInAs('admin'); $headers = array('CONTENT_TYPE' => 'application/json'); $content = json_encode(array( - 'text' => 'a modified comment', + 'text' => 'a modified annotation', )); - $crawler = $this->client->request('PUT', 'annotations/'.$comment->getId().'.json', array(), array(), $headers, $content); + $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals('a modified comment', $content['text']); + $this->assertEquals('a modified annotation', $content['text']); - $commentUpdated = $this->client->getContainer() + $annotationUpdated = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCommentBundle:Comment') - ->findCommentById($comment->getId()); - $this->assertEquals('a modified comment', $commentUpdated->getText()); + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findAnnotationById($annotation->getId()); + $this->assertEquals('a modified annotation', $annotationUpdated->getText()); } } diff --git a/src/Wallabag/CommentBundle/Tests/WallabagCommentTestCase.php b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php similarity index 94% rename from src/Wallabag/CommentBundle/Tests/WallabagCommentTestCase.php rename to src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php index f4a2ae6c..2deff6bf 100644 --- a/src/Wallabag/CommentBundle/Tests/WallabagCommentTestCase.php +++ b/src/Wallabag/AnnotationBundle/Tests/WallabagAnnotationTestCase.php @@ -1,11 +1,11 @@ getReference('admin-user')); - $comment1->setEntry($this->getReference('entry1')); - $comment1->setText('This is my comment /o/'); - $comment1->setQuote('content'); - - $manager->persist($comment1); - - $this->addReference('comment1', $comment1); - - $comment2 = new Comment($this->getReference('admin-user')); - $comment2->setEntry($this->getReference('entry2')); - $comment2->setText('This is my 2nd comment /o/'); - $comment2->setQuote('content'); - - $manager->persist($comment2); - - $this->addReference('comment2', $comment2); - - $manager->flush(); - } - - /** - * {@inheritdoc} - */ - public function getOrder() - { - return 35; - } -} diff --git a/src/Wallabag/CommentBundle/Repository/CommentRepository.php b/src/Wallabag/CommentBundle/Repository/CommentRepository.php deleted file mode 100644 index 15acffbf..00000000 --- a/src/Wallabag/CommentBundle/Repository/CommentRepository.php +++ /dev/null @@ -1,94 +0,0 @@ -createQueryBuilder('c') - ->leftJoin('c.user', 'u') - ->andWhere('u.id = :userId')->setParameter('userId', $userId) - ->orderBy('c.id', 'desc') - ; - } - - /** - * Retrieves all comments for a user. - * - * @param int $userId - * - * @return QueryBuilder - */ - public function getBuilderForAllByUser($userId) - { - return $this - ->getBuilderByUser($userId) - ; - } - - /** - * Get comment for this id. - * - * @param int $commentId - * - * @return array - */ - public function findCommentById($commentId) - { - return $this->createQueryBuilder('c') - ->andWhere('c.id = :commentId')->setParameter('commentId', $commentId) - ->getQuery()->getSingleResult() - ; - } - - /** - * Find comments for entry id. - * - * @param int $entryId - * @param int $userId - * - * @return array - */ - public function findCommentsByPageId($entryId, $userId) - { - return $this->createQueryBuilder('c') - ->where('c.entry = :entryId')->setParameter('entryId', $entryId) - ->andwhere('c.user = :userId')->setParameter('userId', $userId) - ->getQuery()->getResult() - ; - } - - /** - * Find last comment for a given entry id. Used only for tests. - * - * @param int $entryId - * - * @return array - */ - public function findLastCommentByPageId($entryId, $userId) - { - return $this->createQueryBuilder('c') - ->where('c.entry = :entryId')->setParameter('entryId', $entryId) - ->andwhere('c.user = :userId')->setParameter('userId', $userId) - ->orderBy('c.id', 'DESC') - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } -} diff --git a/src/Wallabag/CommentBundle/Resources/config/routing_comments.yml b/src/Wallabag/CommentBundle/Resources/config/routing_comments.yml deleted file mode 100644 index 1d3893d3..00000000 --- a/src/Wallabag/CommentBundle/Resources/config/routing_comments.yml +++ /dev/null @@ -1,4 +0,0 @@ -annotations: - type: rest - resource: "WallabagCommentBundle:WallabagComment" - name_prefix: annotations_ diff --git a/src/Wallabag/CommentBundle/WallabagCommentBundle.php b/src/Wallabag/CommentBundle/WallabagCommentBundle.php deleted file mode 100644 index 8150034d..00000000 --- a/src/Wallabag/CommentBundle/WallabagCommentBundle.php +++ /dev/null @@ -1,9 +0,0 @@ - + * @return ArrayCollection */ - public function getComments() + public function getAnnotations() { - return $this->comments; + return $this->annotations; } /** - * @param Comment $comment + * @param Annotation $annotation */ - public function setComment(Comment $comment) + public function setAnnotation(Annotation $annotation) { - $this->comments[] = $comment; + $this->annotations[] = $annotation; } /** diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 548a164b..e4935b9e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -98,7 +98,7 @@ Toggle favorite: 'Marquer comme favori' Delete: 'Supprimer' "{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.": "{0} Il n'y a pas d'articles.|{1} Il y a un article.|]1,Inf[ Il y a %count% articles." http://website: "http://siteweb" -"{0} No annotations|{1} One annotation|]1,Inf[ %nbComments% annotations": "{0} Aucune annotation|{1} Une annotation|]1,Inf[ %nbComments% annotations" +"{0} No annotations|{1} One annotation|]1,Inf[ %nbAnnotations% annotations": "{0} Aucune annotation|{1} Une annotation|]1,Inf[ %nbAnnotations% annotations" # Edit entry Edit an entry: "Éditer un article" diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index 817e39b8..9323e787 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -29,8 +29,8 @@
  • {% trans %}Does this article appear wrong?{% endtrans %}
  • - {% set nbComments = entry.comments | length %} - {% transchoice nbComments %}{0} No annotations|{1} One annotation|]1,Inf[ %nbComments% annotations{% endtranschoice %} + {% set nbAnnotations = entry.annotations | length %} + {% transchoice nbAnnotations %}{0} No annotations|{1} One annotation|]1,Inf[ %nbAnnotations% annotations{% endtranschoice %}