aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-05-03 10:07:34 +0200
committerJeremy Benoist <j0k3r@users.noreply.github.com>2016-05-03 10:07:34 +0200
commit97c8eb3c2398d0aaf06155de5e0828e4020cb5d4 (patch)
tree44504734b0e5522d8d320e1ea06236080b6ef983
parent2142c714ef997f4853b5649ab86d150e40e6f18a (diff)
parente9023a16eba20655965b658ce4dbb2229dfe2546 (diff)
downloadwallabag-97c8eb3c2398d0aaf06155de5e0828e4020cb5d4.tar.gz
wallabag-97c8eb3c2398d0aaf06155de5e0828e4020cb5d4.tar.zst
wallabag-97c8eb3c2398d0aaf06155de5e0828e4020cb5d4.zip
Merge pull request #2013 from wallabag/fix-display-all-tags
Fix tags listing
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php2
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php36
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig2
4 files changed, 6 insertions, 36 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 16d14d79..8645fb44 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -81,7 +81,7 @@ class TagController extends Controller
81 { 81 {
82 $tags = $this->getDoctrine() 82 $tags = $this->getDoctrine()
83 ->getRepository('WallabagCoreBundle:Tag') 83 ->getRepository('WallabagCoreBundle:Tag')
84 ->findTags($this->getUser()->getId()); 84 ->findAllTags($this->getUser()->getId());
85 85
86 return $this->render( 86 return $this->render(
87 'WallabagCoreBundle:Tag:tags.html.twig', 87 'WallabagCoreBundle:Tag:tags.html.twig',
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php
index afeb985b..abf915fe 100644
--- a/src/Wallabag/CoreBundle/Repository/TagRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php
@@ -3,42 +3,10 @@
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;
8 6
9class TagRepository extends EntityRepository 7class TagRepository extends EntityRepository
10{ 8{
11 /** 9 /**
12 * Return only the QueryBuilder to retrieve all tags for a given user.
13 *
14 * @param int $userId
15 *
16 * @return QueryBuilder
17 */
18 private function getQbForAllTags($userId)
19 {
20 return $this->createQueryBuilder('t')
21 ->leftJoin('t.entries', 'e')
22 ->where('e.user = :userId')->setParameter('userId', $userId);
23 }
24
25 /**
26 * Find Tags and return a Pager.
27 *
28 * @param int $userId
29 *
30 * @return Pagerfanta
31 */
32 public function findTags($userId)
33 {
34 $qb = $this->getQbForAllTags($userId);
35
36 $pagerAdapter = new DoctrineORMAdapter($qb);
37
38 return new Pagerfanta($pagerAdapter);
39 }
40
41 /**
42 * Find Tags. 10 * Find Tags.
43 * 11 *
44 * @param int $userId 12 * @param int $userId
@@ -47,7 +15,9 @@ class TagRepository extends EntityRepository
47 */ 15 */
48 public function findAllTags($userId) 16 public function findAllTags($userId)
49 { 17 {
50 return $this->getQbForAllTags($userId) 18 return $this->createQueryBuilder('t')
19 ->leftJoin('t.entries', 'e')
20 ->where('e.user = :userId')->setParameter('userId', $userId)
51 ->getQuery() 21 ->getQuery()
52 ->getResult(); 22 ->getResult();
53 } 23 }
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
index dfc61751..bb0ca939 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
@@ -4,7 +4,7 @@
4 4
5{% block content %} 5{% block content %}
6 <div class="results"> 6 <div class="results">
7 <div class="nb-results">{{ 'tag.list.number_on_the_page'|transchoice(tags.count) }}</div> 7 <div class="nb-results">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div>
8 </div> 8 </div>
9 9
10 <ul> 10 <ul>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig
index 6b583689..6fd263d8 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig
@@ -4,7 +4,7 @@
4 4
5{% block content %} 5{% block content %}
6 <div class="results clearfix"> 6 <div class="results clearfix">
7 <div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags.count) }}</div> 7 <div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div>
8 </div> 8 </div>
9 <br /> 9 <br />
10 <ul class="row data"> 10 <ul class="row data">