diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-05-27 09:57:51 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-05-27 09:57:51 +0200 |
commit | 839475776bdacf7e939984ee8230cb84d34c2289 (patch) | |
tree | 550432482ed3208d8e63acdca01a6b447a40e1c7 /src/Wallabag | |
parent | 7b67f785ff09e093286f3fd665eb263807cbb760 (diff) | |
parent | 30334567a3a4c82a8bf97fc2fb95b87bb495add1 (diff) | |
download | wallabag-839475776bdacf7e939984ee8230cb84d34c2289.tar.gz wallabag-839475776bdacf7e939984ee8230cb84d34c2289.tar.zst wallabag-839475776bdacf7e939984ee8230cb84d34c2289.zip |
Merge pull request #2052 from danbartram/feature-filter-unread
Add unread filter to entries pages
Diffstat (limited to 'src/Wallabag')
14 files changed, 50 insertions, 0 deletions
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 | |||
87 | ->add('isStarred', CheckboxFilterType::class, [ | 87 | ->add('isStarred', CheckboxFilterType::class, [ |
88 | 'label' => 'entry.filters.starred_label', | 88 | 'label' => 'entry.filters.starred_label', |
89 | ]) | 89 | ]) |
90 | ->add('isUnread', CheckboxFilterType::class, [ | ||
91 | 'label' => 'entry.filters.unread_label', | ||
92 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | ||
93 | if (false === $values['value']) { | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | $expression = $filterQuery->getExpr()->eq('e.isArchived', 'false'); | ||
98 | |||
99 | return $filterQuery->createCondition($expression); | ||
100 | }, | ||
101 | ]) | ||
90 | ->add('previewPicture', CheckboxFilterType::class, [ | 102 | ->add('previewPicture', CheckboxFilterType::class, [ |
91 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 103 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
92 | if (false === $values['value']) { | 104 | 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: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Arkiveret' | 155 | archived_label: 'Arkiveret' |
156 | starred_label: 'Favorit' | 156 | starred_label: 'Favorit' |
157 | unread_label: 'Ulæst' | ||
157 | preview_picture_label: 'Har et vist billede' | 158 | preview_picture_label: 'Har et vist billede' |
158 | preview_picture_help: 'Forhåndsvis billede' | 159 | preview_picture_help: 'Forhåndsvis billede' |
159 | language_label: 'Sprog' | 160 | 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: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Archiviert' | 155 | archived_label: 'Archiviert' |
156 | starred_label: 'Favorisiert' | 156 | starred_label: 'Favorisiert' |
157 | unread_label: 'Ungelesene' | ||
157 | preview_picture_label: 'Vorschaubild vorhanden' | 158 | preview_picture_label: 'Vorschaubild vorhanden' |
158 | preview_picture_help: 'Vorschaubild' | 159 | preview_picture_help: 'Vorschaubild' |
159 | language_label: 'Sprache' | 160 | language_label: 'Sprache' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 876e7900..ae03f809 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -154,6 +154,7 @@ entry: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Archived' | 155 | archived_label: 'Archived' |
156 | starred_label: 'Starred' | 156 | starred_label: 'Starred' |
157 | unread_label: 'Unread' | ||
157 | preview_picture_label: 'Has a preview picture' | 158 | preview_picture_label: 'Has a preview picture' |
158 | preview_picture_help: 'Preview picture' | 159 | preview_picture_help: 'Preview picture' |
159 | language_label: 'Language' | 160 | 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: | |||
154 | status_label: 'Estatus' | 154 | status_label: 'Estatus' |
155 | archived_label: 'Archivado' | 155 | archived_label: 'Archivado' |
156 | starred_label: 'Favorito' | 156 | starred_label: 'Favorito' |
157 | unread_label: 'Sin leer' | ||
157 | preview_picture_label: 'Hay una foto' | 158 | preview_picture_label: 'Hay una foto' |
158 | preview_picture_help: 'Foto de preview' | 159 | preview_picture_help: 'Foto de preview' |
159 | language_label: 'Idioma' | 160 | 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: | |||
154 | status_label: 'وضعیت' | 154 | status_label: 'وضعیت' |
155 | archived_label: 'بایگانیشده' | 155 | archived_label: 'بایگانیشده' |
156 | starred_label: 'برگزیده' | 156 | starred_label: 'برگزیده' |
157 | unread_label: 'خواندهنشده' | ||
157 | preview_picture_label: 'دارای عکس پیشنمایش' | 158 | preview_picture_label: 'دارای عکس پیشنمایش' |
158 | preview_picture_help: 'پیشنمایش عکس' | 159 | preview_picture_help: 'پیشنمایش عکس' |
159 | language_label: 'زبان' | 160 | 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: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Lus' | 155 | archived_label: 'Lus' |
156 | starred_label: 'Favoris' | 156 | starred_label: 'Favoris' |
157 | unread_label: 'Non lus' | ||
157 | preview_picture_label: 'A une photo' | 158 | preview_picture_label: 'A une photo' |
158 | preview_picture_help: 'Photo' | 159 | preview_picture_help: 'Photo' |
159 | language_label: 'Langue' | 160 | 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: | |||
154 | status_label: 'Estatus' | 154 | status_label: 'Estatus' |
155 | archived_label: 'Legits' | 155 | archived_label: 'Legits' |
156 | starred_label: 'Favorits' | 156 | starred_label: 'Favorits' |
157 | unread_label: 'Pas legits' | ||
157 | preview_picture_label: 'A una fotò' | 158 | preview_picture_label: 'A una fotò' |
158 | preview_picture_help: 'Fotò' | 159 | preview_picture_help: 'Fotò' |
159 | language_label: 'Lenga' | 160 | 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: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Zarchiwizowane' | 155 | archived_label: 'Zarchiwizowane' |
156 | starred_label: 'Oznaczone gwiazdką' | 156 | starred_label: 'Oznaczone gwiazdką' |
157 | unread_label: 'Nieprzeczytane' | ||
157 | preview_picture_label: 'Posiada podgląd obrazu' | 158 | preview_picture_label: 'Posiada podgląd obrazu' |
158 | preview_picture_help: 'Podgląd obrazu' | 159 | preview_picture_help: 'Podgląd obrazu' |
159 | language_label: 'Język' | 160 | 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: | |||
154 | status_label: 'Status' | 154 | status_label: 'Status' |
155 | archived_label: 'Arhivat' | 155 | archived_label: 'Arhivat' |
156 | starred_label: 'Steluțe' | 156 | starred_label: 'Steluțe' |
157 | unread_label: 'Necitite' | ||
157 | preview_picture_label: 'Are o imagine de previzualizare' | 158 | preview_picture_label: 'Are o imagine de previzualizare' |
158 | preview_picture_help: 'Previzualizare imagine' | 159 | preview_picture_help: 'Previzualizare imagine' |
159 | language_label: 'Limbă' | 160 | 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: | |||
154 | status_label: 'Durum' | 154 | status_label: 'Durum' |
155 | archived_label: 'Arşiv' | 155 | archived_label: 'Arşiv' |
156 | starred_label: 'Favori' | 156 | starred_label: 'Favori' |
157 | unread_label: 'Okunmayan' | ||
157 | preview_picture_label: 'Resim önizlemesi varsa' | 158 | preview_picture_label: 'Resim önizlemesi varsa' |
158 | preview_picture_help: 'Resim önizlemesi' | 159 | preview_picture_help: 'Resim önizlemesi' |
159 | language_label: 'Dil' | 160 | 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 | |||
@@ -54,6 +54,11 @@ | |||
54 | </div> | 54 | </div> |
55 | 55 | ||
56 | <div class="input-field"> | 56 | <div class="input-field"> |
57 | {{ form_widget(form.isUnread) }} | ||
58 | {{ form_label(form.isUnread) }} | ||
59 | </div> | ||
60 | |||
61 | <div class="input-field"> | ||
57 | {{ form_widget(form.previewPicture) }} | 62 | {{ form_widget(form.previewPicture) }} |
58 | {{ form_label(form.previewPicture) }} | 63 | {{ form_label(form.previewPicture) }} |
59 | </div> | 64 | </div> |
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 1d569226..920fa933 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 @@ | |||
126 | {{ form_label(form.isStarred) }} | 126 | {{ form_label(form.isStarred) }} |
127 | </div> | 127 | </div> |
128 | 128 | ||
129 | <div class="input-field col s6 with-checkbox"> | ||
130 | {{ form_widget(form.isUnread) }} | ||
131 | {{ form_label(form.isUnread) }} | ||
132 | </div> | ||
133 | |||
129 | <div class="col s12"> | 134 | <div class="col s12"> |
130 | <label>{{ 'entry.filters.preview_picture_help'|trans }}</label> | 135 | <label>{{ 'entry.filters.preview_picture_help'|trans }}</label> |
131 | </div> | 136 | </div> |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index df4c34cd..c7087a71 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -471,6 +471,24 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
471 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 471 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
472 | } | 472 | } |
473 | 473 | ||
474 | public function testFilterOnUnreadStatus() | ||
475 | { | ||
476 | $this->logInAs('admin'); | ||
477 | $client = $this->getClient(); | ||
478 | |||
479 | $crawler = $client->request('GET', '/all/list'); | ||
480 | |||
481 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
482 | |||
483 | $data = [ | ||
484 | 'entry_filter[isUnread]' => true, | ||
485 | ]; | ||
486 | |||
487 | $crawler = $client->submit($form, $data); | ||
488 | |||
489 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | ||
490 | } | ||
491 | |||
474 | public function testFilterOnCreationDate() | 492 | public function testFilterOnCreationDate() |
475 | { | 493 | { |
476 | $this->logInAs('admin'); | 494 | $this->logInAs('admin'); |