From 733b2cf19b5d5a93617f24b2447b9a30ba22d303 Mon Sep 17 00:00:00 2001 From: Daniel Bartram Date: Mon, 9 May 2016 14:19:09 +0100 Subject: [PATCH] Add unread filter to entries pages Add the ability to filter for unread pages in the filters menu. --- .../CoreBundle/Form/Type/EntryFilterType.php | 12 ++++++++++++ .../Resources/translations/messages.da.yml | 1 + .../Resources/translations/messages.de.yml | 1 + .../Resources/translations/messages.en.yml | 1 + .../Resources/translations/messages.es.yml | 1 + .../Resources/translations/messages.fa.yml | 1 + .../Resources/translations/messages.fr.yml | 1 + .../Resources/translations/messages.oc.yml | 1 + .../Resources/translations/messages.pl.yml | 1 + .../Resources/translations/messages.ro.yml | 1 + .../Resources/translations/messages.tr.yml | 1 + .../views/themes/baggy/Entry/entries.html.twig | 5 +++++ .../views/themes/material/Entry/entries.html.twig | 5 +++++ 13 files changed, 32 insertions(+) diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index cd4d3490..f3f848e9 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -87,6 +87,18 @@ class EntryFilterType extends AbstractType ->add('isStarred', CheckboxFilterType::class, [ 'label' => 'entry.filters.starred_label', ]) + ->add('isUnread', CheckboxFilterType::class, [ + 'label' => 'entry.filters.unread_label', + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + if (false === $values['value']) { + return; + } + + $expression = $filterQuery->getExpr()->eq('e.isArchived', 'false'); + + return $filterQuery->createCondition($expression); + }, + ]) ->add('previewPicture', CheckboxFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 8d392063..1e58352d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Arkiveret' starred_label: 'Favorit' + unread_label: 'Ulæst' preview_picture_label: 'Har et vist billede' preview_picture_help: 'Forhåndsvis billede' language_label: 'Sprog' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index c7a89492..512b01bc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Archiviert' starred_label: 'Favorisiert' + unread_label: 'Ungelesene' preview_picture_label: 'Vorschaubild vorhanden' preview_picture_help: 'Vorschaubild' language_label: 'Sprache' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 1cc42404..6658baa9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Archived' starred_label: 'Starred' + unread_label: 'Unread' preview_picture_label: 'Has a preview picture' preview_picture_help: 'Preview picture' language_label: 'Language' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index e8461247..0ae2e243 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -154,6 +154,7 @@ entry: status_label: 'Estatus' archived_label: 'Archivado' starred_label: 'Favorito' + unread_label: 'Sin leer' preview_picture_label: 'Hay una foto' preview_picture_help: 'Foto de preview' language_label: 'Idioma' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index d34ff8ff..b0601543 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -154,6 +154,7 @@ entry: status_label: 'وضعیت' archived_label: 'بایگانی‌شده' starred_label: 'برگزیده' + unread_label: 'خوانده‌نشده' preview_picture_label: 'دارای عکس پیش‌نمایش' preview_picture_help: 'پیش‌نمایش عکس' language_label: 'زبان' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 80ba0546..954ab0c3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Lus' starred_label: 'Favoris' + unread_label: 'Non lus' preview_picture_label: 'A une photo' preview_picture_help: 'Photo' language_label: 'Langue' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 46f58bbf..24b8c6e2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -154,6 +154,7 @@ entry: status_label: 'Estatus' archived_label: 'Legits' starred_label: 'Favorits' + unread_label: 'Pas legits' preview_picture_label: 'A una fotò' preview_picture_help: 'Fotò' language_label: 'Lenga' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 292749ed..fa23f0b8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Zarchiwizowane' starred_label: 'Oznaczone gwiazdką' + unread_label: 'Nieprzeczytane' preview_picture_label: 'Posiada podgląd obrazu' preview_picture_help: 'Podgląd obrazu' language_label: 'Język' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 45040f35..648ba370 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -154,6 +154,7 @@ entry: status_label: 'Status' archived_label: 'Arhivat' starred_label: 'Steluțe' + unread_label: 'Necitite' preview_picture_label: 'Are o imagine de previzualizare' preview_picture_help: 'Previzualizare imagine' language_label: 'Limbă' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 8a095a5b..0fc8d328 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -154,6 +154,7 @@ entry: status_label: 'Durum' archived_label: 'Arşiv' starred_label: 'Favori' + unread_label: 'Okunmayan' preview_picture_label: 'Resim önizlemesi varsa' preview_picture_help: 'Resim önizlemesi' language_label: 'Dil' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index a2caaebf..778625ae 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig @@ -53,6 +53,11 @@ {{ form_label(form.isStarred) }} +
+ {{ form_widget(form.isUnread) }} + {{ form_label(form.isUnread) }} +
+
{{ form_widget(form.previewPicture) }} {{ form_label(form.previewPicture) }} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index cc4038c5..9ce5b645 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -126,6 +126,11 @@ {{ form_label(form.isStarred) }}
+
+ {{ form_widget(form.isUnread) }} + {{ form_label(form.isUnread) }} +
+
-- 2.41.0