diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 176b7ea07..ba2f53662 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -93,7 +93,7 @@ class EntryFilterType extends AbstractType 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $value = $values['value']; if (\strlen($value) <= 2 || empty($value)) { - return; + return false; } $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->lower($filterQuery->getExpr()->literal('%' . $value . '%'))); @@ -105,7 +105,7 @@ class EntryFilterType extends AbstractType 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $value = $values['value']; if (false === \array_key_exists($value, Response::$statusTexts)) { - return; + return false; } $paramName = sprintf('%s', str_replace('.', '_', $field)); @@ -129,7 +129,7 @@ class EntryFilterType extends AbstractType 'data' => $options['filter_unread'], 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { - return; + return false; } $expression = $filterQuery->getExpr()->eq('e.isArchived', 'false'); @@ -137,10 +137,22 @@ class EntryFilterType extends AbstractType return $filterQuery->createCondition($expression); }, ]) + ->add('isAnnotated', CheckboxFilterType::class, [ + 'label' => 'entry.filters.annotated_label', + 'data' => $options['filter_annotated'], + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + if (false === $values['value']) { + return false; + } + + $qb = $filterQuery->getQueryBuilder(); + $qb->innerJoin('e.annotations', 'a'); + }, + ]) ->add('previewPicture', CheckboxFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { - return; + return false; } $expression = $filterQuery->getExpr()->isNotNull($field); @@ -152,7 +164,7 @@ class EntryFilterType extends AbstractType ->add('isPublic', CheckboxFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { - return; + return false; } // is_public isn't a real field @@ -183,6 +195,7 @@ class EntryFilterType extends AbstractType 'filter_archived' => false, 'filter_starred' => false, 'filter_unread' => false, + 'filter_annotated' => false, ]); } } diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 98d374a2d..775006fc1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -247,6 +247,7 @@ entry: archived_label: Archived starred_label: Starred unread_label: Unread + annotated_label: Annotated preview_picture_label: Has a preview picture preview_picture_help: Preview picture is_public_label: Has a public link 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 f80156834..604d399da 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 @@ -131,6 +131,11 @@ {{ form_label(form.isUnread) }} +