aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2018-09-02 16:43:49 +0200
committerKevin Decherf <kevin@kdecherf.com>2018-09-02 17:50:02 +0200
commit86fd3da135d9ca2241dc09680d5dac1dd57fc707 (patch)
treedc25d02f454dc9a90bb9b55c2f617a0228a499b1
parent685a5d745e2b723a09111d7d31157cced67ea9b4 (diff)
downloadwallabag-tags-3235.tar.gz
wallabag-tags-3235.tar.zst
wallabag-tags-3235.zip
Show untagged entries count on tag listtags-3235
Closes #3235 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
-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 616c37f2..bc794c7f 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -86,9 +86,12 @@ class TagController extends Controller
86 { 86 {
87 $tags = $this->get('wallabag_core.tag_repository') 87 $tags = $this->get('wallabag_core.tag_repository')
88 ->findAllFlatTagsWithNbEntries($this->getUser()->getId()); 88 ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
89 $untagged = $this->get('wallabag_core.entry_repository')
90 ->countUntaggedEntriesForUser($this->getUser()->getId());
89 91
90 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ 92 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
91 'tags' => $tags, 93 'tags' => $tags,
94 'untagged' => $untagged
92 ]); 95 ]);
93 } 96 }
94 97
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index b5e35eff..3a1f19b4 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -116,6 +116,20 @@ class EntryRepository extends EntityRepository
116 } 116 }
117 117
118 /** 118 /**
119 * Retrieve the number of untagged entries for a user.
120 *
121 * @param int $userId
122 *
123 * @return int
124 */
125 public function countUntaggedEntriesByUser($userId)
126 {
127 return $this->getRawBuilderForUntaggedByUser($userId)
128 ->select('count(e.id)')
129 ->getSingleScalarResult();
130 }
131
132 /**
119 * Find Entries. 133 * Find Entries.
120 * 134 *
121 * @param int $userId 135 * @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 070d5629..e428ddf9 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
@@ -19,6 +19,6 @@
19 </ul> 19 </ul>
20 20
21 <div> 21 <div>
22 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a> 22 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
23 </div> 23 </div>
24{% endblock %} 24{% 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 c15b5146..6a8272fe 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
@@ -23,6 +23,6 @@
23 </div> 23 </div>
24 24
25 <div> 25 <div>
26 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a> 26 <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
27 </div> 27 </div>
28{% endblock %} 28{% endblock %}