From b6520f0b15ac35215e2d94d16a31ea971874dce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 26 Aug 2016 16:55:41 +0200 Subject: Add untagged entries Fix #1631 --- .../CoreBundle/Controller/EntryController.php | 19 +++++++++++++++++++ .../CoreBundle/Controller/ExportController.php | 2 +- .../CoreBundle/Repository/EntryRepository.php | 16 ++++++++++++++++ .../CoreBundle/Resources/translations/messages.da.yml | 1 + .../CoreBundle/Resources/translations/messages.de.yml | 1 + .../CoreBundle/Resources/translations/messages.en.yml | 2 ++ .../CoreBundle/Resources/translations/messages.es.yml | 1 + .../CoreBundle/Resources/translations/messages.fa.yml | 1 + .../CoreBundle/Resources/translations/messages.fr.yml | 1 + .../CoreBundle/Resources/translations/messages.it.yml | 1 + .../CoreBundle/Resources/translations/messages.oc.yml | 1 + .../CoreBundle/Resources/translations/messages.pl.yml | 1 + .../CoreBundle/Resources/translations/messages.ro.yml | 1 + .../CoreBundle/Resources/translations/messages.tr.yml | 1 + .../Resources/views/themes/_title.html.twig | 2 ++ .../Resources/views/themes/baggy/Tag/tags.html.twig | 4 ++++ .../views/themes/material/Tag/tags.html.twig | 3 +++ 17 files changed, 57 insertions(+), 1 deletion(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index d71ba6cd..624576b5 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -226,6 +226,10 @@ class EntryController extends Controller $repository = $this->get('wallabag_core.entry_repository'); switch ($type) { + case 'untagged': + $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); + + break; case 'starred': $qb = $repository->getBuilderForStarredByUser($this->getUser()->getId()); break; @@ -523,4 +527,19 @@ class EntryController extends Controller ['entry' => $entry] ); } + + /** + * Shows untagged articles for current user. + * + * @param Request $request + * @param int $page + * + * @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"}) + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function showUntaggedEntriesAction(Request $request, $page) + { + return $this->showEntries('untagged', $request, $page); + } } diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 959b308d..6191d5d7 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -46,7 +46,7 @@ class ExportController extends Controller * * @Route("/export/{category}.{format}", name="export_entries", requirements={ * "format": "epub|mobi|pdf|json|xml|txt|csv", - * "category": "all|unread|starred|archive|tag_entries" + * "category": "all|unread|starred|archive|tag_entries|untagged" * }) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index fada40bb..e5c21679 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -84,6 +84,22 @@ class EntryRepository extends EntityRepository ; } + /** + * Retrieves untagged entries for a user. + * + * @param int $userId + * + * @return QueryBuilder + */ + public function getBuilderForUntaggedByUser($userId) + { + return $this + ->getBuilderByUser($userId) + ->leftJoin('e.tags', 't') + ->groupBy('e.id') + ->having('count(t.id) = 0'); + } + /** * Find Entries. * diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index f9b7bfac..cacc5865 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -312,6 +312,7 @@ tag: page_title: 'Tags' 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' import: # page_title: 'Import' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 79d03286..e1ab7690 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -312,6 +312,7 @@ tag: page_title: 'Tags' list: number_on_the_page: '{0} Es gibt keine Tags.|{1} Es gibt einen Tag.|]1,Inf[ Es gibt %count% Tags.' + # see_untagged_entries: 'See untagged entries' import: page_title: 'Importieren' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index d921b39f..220c4d9c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -140,6 +140,7 @@ entry: archived: 'Archived entries' filtered: 'Filtered entries' filtered_tags: 'Filtered by tags' + untagged: 'Untagged entries' list: number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.' reading_time: 'estimated reading time' @@ -312,6 +313,7 @@ tag: page_title: 'Tags' 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' import: page_title: 'Import' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index c2ec4dbd..6391fbe6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -312,6 +312,7 @@ tag: page_title: 'Etiquetas' list: number_on_the_page: '{0} No hay ninguna etiqueta.|{1} Hay una etiqueta.|]1,Inf[ Hay %count% etiquetas.' + # see_untagged_entries: 'See untagged entries' import: page_title: 'Importar' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 561ed907..8d75dd52 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -312,6 +312,7 @@ tag: page_title: 'برچسب‌ها' list: number_on_the_page: '{0} هیچ برچسبی نیست.|{1} یک برچسب هست.|]1,Inf[ %count% برچسب هست.' + # see_untagged_entries: 'See untagged entries' import: page_title: 'درون‌ریزی' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index c0671883..87c3e501 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -312,6 +312,7 @@ tag: page_title: 'Tags' 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' import: page_title: 'Importer' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 2e3dd08b..bdf0cd97 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -310,6 +310,7 @@ tag: page_title: 'Tags' list: number_on_the_page: "{0} Non ci sono tag.|{1} C'è un tag.|]1,Inf[ ci sono %count% tag." + # see_untagged_entries: 'See untagged entries' import: page_title: 'Importa' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 7b978a60..70bc553c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -312,6 +312,7 @@ tag: page_title: 'Etiquetas' 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: 'See untagged entries' import: page_title: 'Importar' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index da170e4d..8572ef2d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -312,6 +312,7 @@ tag: page_title: 'Tagi' list: number_on_the_page: '{0} Nie ma tagów.|{1} Jest jeden tag.|]1,Inf[ Są %count% tagi.' + # see_untagged_entries: 'See untagged entries' import: page_title: 'Import' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index fa2d6468..166a8e6e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -312,6 +312,7 @@ tag: page_title: 'Tag-uri' 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' import: # page_title: 'Import' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 05c31336..7386d70d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -312,6 +312,7 @@ tag: page_title: 'Etiketler' 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' import: page_title: 'İçe Aktar' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/_title.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/_title.html.twig index 525e2a20..d1c2f203 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/_title.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/_title.html.twig @@ -8,6 +8,8 @@ {{ 'entry.page_titles.filtered'|trans }} {% elseif currentRoute == 'tag_entries' %} {{ 'entry.page_titles.filtered_tags'|trans }} +{% elseif currentRoute == 'untagged' %} + {{ 'entry.page_titles.untagged'|trans }} {% else %} {{ 'entry.page_titles.unread'|trans }} {% endif %} 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 739e1486..50043907 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 @@ -12,4 +12,8 @@
  • {{tag.label}} ({{ tag.entries.getValues | length }})
  • {% endfor %} + +
    + {{ 'tag.list.see_untagged_entries'|trans }} +
    {% 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 9495f543..1690633a 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 @@ -12,4 +12,7 @@
  • {{tag.label}} ({{ tag.entries.getValues | length }})
  • {% endfor %} +
    + {{ 'tag.list.see_untagged_entries'|trans }} +
    {% endblock %} -- cgit v1.2.3