aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php33
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php18
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig27
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/base.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig2
5 files changed, 80 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
new file mode 100644
index 00000000..89284231
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -0,0 +1,33 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\CoreBundle\Entity\Tag;
9
10class TagController extends Controller
11{
12 /**
13 * Shows tags for current user.
14 *
15 * @Route("/tag/list", name="tag")
16 *
17 * @return \Symfony\Component\HttpFoundation\Response
18 */
19 public function showTagAction()
20 {
21 $tags = $this->getDoctrine()
22 ->getRepository('WallabagCoreBundle:Tag')
23 ->findTags($this->getUser()->getId());
24
25 return $this->render(
26 'WallabagCoreBundle:Tag:tags.html.twig',
27 array(
28 'tags' => $tags
29 )
30 );
31 }
32
33}
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php
index 52f319f1..51f1cd42 100644
--- a/src/Wallabag/CoreBundle/Repository/TagRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php
@@ -3,7 +3,25 @@
3namespace Wallabag\CoreBundle\Repository; 3namespace Wallabag\CoreBundle\Repository;
4 4
5use Doctrine\ORM\EntityRepository; 5use Doctrine\ORM\EntityRepository;
6use Pagerfanta\Adapter\DoctrineORMAdapter;
7use Pagerfanta\Pagerfanta;
6 8
7class TagRepository extends EntityRepository 9class TagRepository extends EntityRepository
8{ 10{
11 /**
12 * Find Tags.
13 *
14 * @param int $userId
15 *
16 * @return array
17 */
18 public function findTags($userId)
19 {
20 $qb = $this->createQueryBuilder('t')
21 ->where('t.user =:userId')->setParameter('userId', $userId);
22
23 $pagerAdapter = new DoctrineORMAdapter($qb);
24
25 return new Pagerfanta($pagerAdapter);
26 }
9} 27}
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 00000000..7c2a9f45
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig
@@ -0,0 +1,27 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title "Tags" %}
4
5{% block content %}
6 {% block pager %}
7 {% if tags is not empty %}
8 <div class="results">
9 <div class="nb-results">{{ tags.count }} {% trans %}tags{% endtrans %}</div>
10 <div class="pagination">
11 {% for p in range(1, tags.nbPages) %}
12 <li>
13 <a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a>
14 </li>
15 {% endfor %}
16 </div>
17 </div>
18 {% endif %}
19 {% endblock %}
20
21 {% if tags is empty %}
22 <div class="messages warning"><p>{% trans %}No tags found.{% endtrans %}</p></div>
23 {% else %}
24 {% for tag in tags %}{{tag.title}}
25 {% endfor %}
26 {% endif %}
27{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
index 4f27f413..223e8433 100644
--- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
@@ -71,7 +71,7 @@
71 <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> 71 <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
72 <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> 72 <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
73 <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> 73 <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
74 <li><a href="?view=tags">{% trans %}tags{% endtrans %}</a></li> 74 <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li>
75 <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li> 75 <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
76 <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> 76 <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
77 <div id="search-form" class="messages info popup-form"> 77 <div id="search-form" class="messages info popup-form">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig
index 0c8a2a29..5f8363ca 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig
@@ -74,7 +74,7 @@
74 <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> 74 <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
75 <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> 75 <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
76 <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li> 76 <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li>
77 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="?view=tags">{% trans %}tags{% endtrans %}</a></li> 77 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li>
78 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> 78 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
79 <li class="bold"><a class="waves-effect" class="icon icon-power" href="{{ path('logout') }}" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li> 79 <li class="bold"><a class="waves-effect" class="icon icon-power" href="{{ path('logout') }}" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li>
80 </ul> 80 </ul>