]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Show untagged entries count on tag list (#3993)
authorThomas Citharel <github@tcit.fr>
Thu, 6 Jun 2019 12:09:23 +0000 (14:09 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Jun 2019 12:09:23 +0000 (14:09 +0200)
Show untagged entries count on tag list

18 files changed:
src/Wallabag/CoreBundle/Controller/TagController.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig

index d0155c6018bde6877786e1817a637deee6b18604..90d36d71ae28da3f43ea6795e28f556396626003 100644 (file)
@@ -87,6 +87,8 @@ class TagController extends Controller
     {
         $tags = $this->get('wallabag_core.tag_repository')
             ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
+        $nbEntriesUntagged = $this->get('wallabag_core.entry_repository')
+            ->countUntaggedEntriesByUser($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,
+            'nbEntriesUntagged' => $nbEntriesUntagged,
         ]);
     }
 
index 16c448851f444e73f3652313e1baffaa09ea9e40..d967598263c5e1237f7d7e2a2ea6f1a89df3a4ae 100644 (file)
@@ -129,6 +129,21 @@ 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 (int) $this->getRawBuilderForUntaggedByUser($userId)
+            ->select('count(e.id)')
+            ->getQuery()
+            ->getSingleScalarResult();
+    }
+
     /**
      * Find Entries.
      *
index c6a91cd1425af2aab0f9cf5559a6d38929a218b3..b6e067ccef2652d815f10c95ab2d3eee4dc705b6 100644 (file)
@@ -422,6 +422,7 @@ tag:
     list:
         # number_on_the_page: '{0} There is no tag.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
         # see_untagged_entries: 'See untagged entries'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         # add: 'Add'
         # placeholder: 'You can add several tags, separated by a comma.'
index 4b78530603ff6b7a420a84ba010052c4ee4809c9..072cac0aa3c007581c9d96f0093cd500b02dbb74 100644 (file)
@@ -413,6 +413,7 @@ tag:
     list:
         number_on_the_page: '{0} Es gibt keine Tags.|{1} Es gibt einen Tag.|]1,Inf[ Es gibt %count% Tags.'
         see_untagged_entries: 'Zeige nicht getaggte Einträge'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Hinzufügen'
         placeholder: 'Du kannst verschiedene Tags, getrennt von einem Komma, hinzufügen.'
index 1f8c47aac2c6b1938f35dad5c9c74a73a0431d68..e1631d1098c48caaf3ddd26c488a5bfa6921f5d7 100644 (file)
@@ -422,6 +422,7 @@ tag:
     list:
         number_on_the_page: '{0} There are no tags.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
         see_untagged_entries: 'See untagged entries'
+        no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Add'
         placeholder: 'You can add several tags, separated by a comma.'
index 06fa1e48f5e04917fcd3dda9ddac1de137b81d82..ebd4477a5a900fbff94af9d1944e764f7fd534da 100644 (file)
@@ -422,6 +422,7 @@ tag:
     list:
         number_on_the_page: '{0} No hay ninguna etiqueta.|{1} Hay una etiqueta.|]1,Inf[ Hay %count% etiquetas.'
         see_untagged_entries: 'Ver artículos sin etiquetas'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Añadir'
         placeholder: 'Puedes añadir varias etiquetas, separadas por una coma.'
index 5c1eaccc72db4615a68a43cf69801d727750967a..e3857e244e0b05254365952bf03c2af664f97f89 100644 (file)
@@ -422,6 +422,7 @@ tag:
     list:
         number_on_the_page: '{0} هیچ برچسبی نیست.|{1} یک برچسب هست.|]1,Inf[ %count% برچسب هست.'
         # see_untagged_entries: 'See untagged entries'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         # add: 'Add'
         # placeholder: 'You can add several tags, separated by a comma.'
index 09c1cc8f0eec77ab0e720b3b52351844f130f7ac..97cb3272338a36bfd9ae0fd37c10eeb83f3d1296 100644 (file)
@@ -422,6 +422,7 @@ tag:
     list:
         number_on_the_page: "{0} Il n’y a pas de tag.|{1} Il y a un tag.|]1,Inf[ Il y a %count% tags."
         see_untagged_entries: "Voir les articles sans tag"
+        no_untagged_entries: 'Aucun article sans tag.'
     new:
         add: "Ajouter"
         placeholder: "Vous pouvez ajouter plusieurs tags, séparés par une virgule."
index 92f2415b8a817691262bf1e8f4abcae43af3d3fb..7c0110a42b9f2664cb0b2b16a9ff7eb765ae8e4e 100644 (file)
@@ -421,6 +421,7 @@ tag:
     list:
         number_on_the_page: "{0} Non ci sono etichette.|{1} C'è un'etichetta.|]1,Inf[ ci sono %count% etichette."
         see_untagged_entries: 'Vedi articoli non etichettati'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Aggiungi'
         placeholder: 'Puoi aggiungere varie etichette, separate da una virgola.'
index 4439cbcd57c0555d978aa89857b3848af72560b1..e74d1a20132a9decb3f63147a5b70ae375947f83 100644 (file)
@@ -421,6 +421,7 @@ tag:
     list:
         number_on_the_page: "{0} I a pas cap d'etiquetas.|{1} I a una etiqueta.|]1,Inf[ I a %count% etiquetas."
         see_untagged_entries: "Afichar las entradas sens etiquetas"
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Ajustar'
         placeholder: "Podètz ajustar mai qu'una etiqueta, separadas per de virgula."
index 8311770f3686d2b846ea25ac40a15e3dc0501c60..f4da2b1868f0eea04e7b3eb6c84fd374ec6bb174 100644 (file)
@@ -421,6 +421,7 @@ tag:
     list:
         number_on_the_page: '{0} Nie ma tagów.|{1} Jest jeden tag.|]1,Inf[ Są %count% tagi.'
         see_untagged_entries: 'Zobacz nieotagowane wpisy'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Dodaj'
         placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.'
index c83bf6c1ea7ffc87c78ebae6053b9b3a2203ab65..76d2bebe7330b730ffad7defd64dfded0fa83d2d 100644 (file)
@@ -421,6 +421,7 @@ tag:
     list:
         number_on_the_page: '{0} Não existem tags.|{1} Uma tag.|]1,Inf[ Existem %count% tags.'
         see_untagged_entries: 'Ver entradas sem tags'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         # add: 'Add'
         # placeholder: 'You can add several tags, separated by a comma.'
index c8bf80831a5d20aa3f994472441e3f585e5fdda6..c10df5fe882708b0dde5d4ce5c97ed0af69353f2 100644 (file)
@@ -421,6 +421,7 @@ tag:
     list:
         # number_on_the_page: '{0} There is no tag.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
         # see_untagged_entries: 'See untagged entries'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         # add: 'Add'
         # placeholder: 'You can add several tags, separated by a comma.'
index 5d0e70c934089142db93aec5248035f2042bdb29..48695b3fd47e3b75ed6bfe91068a5b687a58ea1b 100644 (file)
@@ -410,6 +410,7 @@ tag:
     list:
         number_on_the_page: '{0} Теги не найдены.|{1} Найден один тег.|]1,Inf[ Найдено %count% тегов.'
         see_untagged_entries: 'Просмотреть записи без тегов'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'Добавить'
         placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.'
index 66426d5354af9ed7b121214cefd6a02b2735b6e9..da5bbecd835650323b9351ed91bab960dce31157 100644 (file)
@@ -419,6 +419,7 @@ tag:
     list:
         number_on_the_page: '{0} ไม่มีการแท็ก|{1} มีหนึ่งแท็ก|]1,Inf[ มี %count% แท็ก'
         see_untagged_entries: 'พบรายการที่ไม่ได้แท็ก'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         add: 'เพิ่ม'
         placeholder: 'คุณสามารถเพิ่มได้หลายแท็ก, จากการแบ่งโดย comma'
index 50bd38e366a2dfc8ef748caf30e0d2c180212a39..8f42d3813c5e2dcebb62e35784b99d0c35d85313 100644 (file)
@@ -419,6 +419,7 @@ tag:
     list:
         number_on_the_page: '{0} Herhangi bir etiket yok.|{1} Burada bir adet etiket var.|]1,Inf[ Burada %count% adet etiket var.'
         # see_untagged_entries: 'See untagged entries'
+        # no_untagged_entries: 'There are no untagged entries.'
     new:
         # add: 'Add'
         # placeholder: 'You can add several tags, separated by a comma.'
index ae8403bd695099486f59930984728ad67286c2bf..aa17b8428e5b00f53207b6f76a8c2bf1ed6677b1 100644 (file)
     </ul>
 
     <div>
-        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
+        {% if nbEntriesUntagged == 0 %}
+            {{ 'tag.list.no_untagged_entries'|trans }}
+        {% else %}
+            <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{nbEntriesUntagged}})</a>
+        {% endif %}
     </div>
 {% endblock %}
index 79907bbb51f971a5aff744ff03b5da1847a821a5..0a3475ef080c932819df051a6bb8cd283e1ce8ae 100644 (file)
     </div>
 
     <div>
-        <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
+        {% if nbEntriesUntagged == 0 %}
+            {{ 'tag.list.no_untagged_entries'|trans }}
+        {% else %}
+            <a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{nbEntriesUntagged}})</a>
+        {% endif %}
     </div>
 {% endblock %}