diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php new file mode 100644 index 000000000..e448cea1e --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -0,0 +1,31 @@ +getDoctrine() + ->getRepository('WallabagCoreBundle:Tag') + ->findTags($this->getUser()->getId()); + + return $this->render( + 'WallabagCoreBundle:Tag:tags.html.twig', + array( + 'tags' => $tags + ) + ); + } + +} diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 52f319f11..51f1cd429 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -3,7 +3,25 @@ namespace Wallabag\CoreBundle\Repository; use Doctrine\ORM\EntityRepository; +use Pagerfanta\Adapter\DoctrineORMAdapter; +use Pagerfanta\Pagerfanta; class TagRepository extends EntityRepository { + /** + * Find Tags. + * + * @param int $userId + * + * @return array + */ + public function findTags($userId) + { + $qb = $this->createQueryBuilder('t') + ->where('t.user =:userId')->setParameter('userId', $userId); + + $pagerAdapter = new DoctrineORMAdapter($qb); + + return new Pagerfanta($pagerAdapter); + } } diff --git a/src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig new file mode 100644 index 000000000..c2a461b83 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig @@ -0,0 +1,13 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title "Tags" %} + +{% block content %} + {% if tags is empty %} +

{% trans %}No tags found.{% endtrans %}

+ {% else %} + {% for tag in tags %} + {{tag.label}} + {% endfor %} + {% endif %} +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig index f17feeddc..162fb463d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig @@ -71,7 +71,7 @@
  • {% trans %}unread{% endtrans %}
  • {% trans %}favorites{% endtrans %}
  • {% trans %}archive{% endtrans %}
  • -
  • {% trans %}tags{% endtrans %}
  • +
  • {% trans %}tags{% endtrans %}
  • {% trans %}save a link{% endtrans %}
  • {% trans %}search{% endtrans %}