Merge pull request #2052 from danbartram/feature-filter-unread

Add unread filter to entries pages
This commit is contained in:
Jeremy Benoist 2016-05-27 09:57:51 +02:00
commit 839475776b
14 changed files with 50 additions and 0 deletions

View file

@ -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']) {

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -154,6 +154,7 @@ entry:
status_label: 'وضعیت'
archived_label: 'بایگانی‌شده'
starred_label: 'برگزیده'
unread_label: 'خوانده‌نشده'
preview_picture_label: 'دارای عکس پیش‌نمایش'
preview_picture_help: 'پیش‌نمایش عکس'
language_label: 'زبان'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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ă'

View file

@ -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'

View file

@ -53,6 +53,11 @@
{{ form_label(form.isStarred) }}
</div>
<div class="input-field">
{{ form_widget(form.isUnread) }}
{{ form_label(form.isUnread) }}
</div>
<div class="input-field">
{{ form_widget(form.previewPicture) }}
{{ form_label(form.previewPicture) }}

View file

@ -126,6 +126,11 @@
{{ form_label(form.isStarred) }}
</div>
<div class="input-field col s6 with-checkbox">
{{ form_widget(form.isUnread) }}
{{ form_label(form.isUnread) }}
</div>
<div class="col s12">
<label>{{ 'entry.filters.preview_picture_help'|trans }}</label>
</div>

View file

@ -471,6 +471,24 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(1, $crawler->filter('div[class=entry]'));
}
public function testFilterOnUnreadStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/all/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
'entry_filter[isUnread]' => true,
];
$crawler = $client->submit($form, $data);
$this->assertCount(4, $crawler->filter('div[class=entry]'));
}
public function testFilterOnCreationDate()
{
$this->logInAs('admin');