aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2018-09-02 16:43:49 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-06-05 17:03:51 +0200
commitad51743e8bd15782a25c5e717c87786d34091ce3 (patch)
treec3f52d679aa2ed1b8c364015b755bf554cc85509 /src/Wallabag
parent7e5b7e029a5ba7aadc8128243afaa00e2a870645 (diff)
downloadwallabag-ad51743e8bd15782a25c5e717c87786d34091ce3.tar.gz
wallabag-ad51743e8bd15782a25c5e717c87786d34091ce3.tar.zst
wallabag-ad51743e8bd15782a25c5e717c87786d34091ce3.zip
Show untagged entries count on tag list
Closes #3235 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php3
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php14
-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, 19 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index d0155c60..bd50de7f 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -87,6 +87,8 @@ class TagController extends Controller
87 { 87 {
88 $tags = $this->get('wallabag_core.tag_repository') 88 $tags = $this->get('wallabag_core.tag_repository')
89 ->findAllFlatTagsWithNbEntries($this->getUser()->getId()); 89 ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
90 $untagged = $this->get('wallabag_core.entry_repository')
91 ->countUntaggedEntriesForUser($this->getUser()->getId());
90 92
91 $renameForms = []; 93 $renameForms = [];
92 foreach ($tags as $tag) { 94 foreach ($tags as $tag) {
@@ -96,6 +98,7 @@ class TagController extends Controller
96 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ 98 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
97 'tags' => $tags, 99 'tags' => $tags,
98 'renameForms' => $renameForms, 100 'renameForms' => $renameForms,
101 'untagged' => $untagged,
99 ]); 102 ]);
100 } 103 }
101 104
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 16c44885..77d88c9c 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -130,6 +130,20 @@ class EntryRepository extends EntityRepository
130 } 130 }
131 131
132 /** 132 /**
133 * Retrieve the number of untagged entries for a user.
134 *
135 * @param int $userId
136 *
137 * @return int
138 */
139 public function countUntaggedEntriesByUser($userId)
140 {
141 return $this->getRawBuilderForUntaggedByUser($userId)
142 ->select('count(e.id)')
143 ->getSingleScalarResult();
144 }
145
146 /**
133 * Find Entries. 147 * Find Entries.
134 * 148 *
135 * @param int $userId 149 * @param int $userId
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 ae8403bd..cddd6e13 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
@@ -31,6 +31,6 @@
31 </ul> 31 </ul>
32 32
33 <div> 33 <div>
34 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a> 34 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
35 </div> 35 </div>
36{% endblock %} 36{% endblock %}
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 79907bbb..552cafc9 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
@@ -34,6 +34,6 @@
34 </div> 34 </div>
35 35
36 <div> 36 <div>
37 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a> 37 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
38 </div> 38 </div>
39{% endblock %} 39{% endblock %}