]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Show untagged entries count on tag list tags-3235
authorKevin Decherf <kevin@kdecherf.com>
Sun, 2 Sep 2018 14:43:49 +0000 (16:43 +0200)
committerKevin Decherf <kevin@kdecherf.com>
Sun, 2 Sep 2018 15:50:02 +0000 (17:50 +0200)
Closes #3235

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
src/Wallabag/CoreBundle/Controller/TagController.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig

index 616c37f2c63e23fdb9a407aec3f294bd67d57207..bc794c7f406fb5abd32f0e4f4ceab4946f1301da 100644 (file)
@@ -86,9 +86,12 @@ 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());
 
         return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
             'tags' => $tags,
+            'untagged' => $untagged
         ]);
     }
 
index b5e35eff3848a69a8e0ee43e769a7fa55aee18b1..3a1f19b4ccad3adc761f6cff35c32c184859ce85 100644 (file)
@@ -115,6 +115,20 @@ class EntryRepository extends EntityRepository
             ->andWhere('size(e.tags) = 0');
     }
 
+    /**
+     * 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.
      *
index 070d5629a4474a9a4afcc69e4de383eabe495b18..e428ddf91e254186967034e8277c4dc061f6b171 100644 (file)
@@ -19,6 +19,6 @@
     </ul>
 
     <div>
-        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
+        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
     </div>
 {% endblock %}
index c15b5146e3f561d87bd83098e0acb445d2671e4a..6a8272feef379d1dd854617fc0a57f9bf7be6cc8 100644 (file)
@@ -23,6 +23,6 @@
     </div>
 
     <div>
-        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
+        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{untagged}})</a>
     </div>
 {% endblock %}