diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index d0155c601..bd50de7fb 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -87,6 +87,8 @@ class TagController extends Controller { $tags = $this->get('wallabag_core.tag_repository') ->findAllFlatTagsWithNbEntries($this->getUser()->getId()); + $untagged = $this->get('wallabag_core.entry_repository') + ->countUntaggedEntriesForUser($this->getUser()->getId()); $renameForms = []; foreach ($tags as $tag) { @@ -96,6 +98,7 @@ class TagController extends Controller return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ 'tags' => $tags, 'renameForms' => $renameForms, + 'untagged' => $untagged, ]); } diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 16c448851..77d88c9c2 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -129,6 +129,20 @@ class EntryRepository extends EntityRepository ->andWhere('t.id is null'); } + /** + * Retrieve the number of untagged entries for a user. + * + * @param int $userId + * + * @return int + */ + public function countUntaggedEntriesByUser($userId) + { + return $this->getRawBuilderForUntaggedByUser($userId) + ->select('count(e.id)') + ->getSingleScalarResult(); + } + /** * Find Entries. * 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 ae8403bd6..cddd6e13d 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 @@
- {{ 'tag.list.see_untagged_entries'|trans }} + {{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})
{% 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 79907bbb5..552cafc94 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 @@
- {{ 'tag.list.see_untagged_entries'|trans }} + {{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})
{% endblock %}