mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Added annotated filter
This commit is contained in:
parent
6dfc031839
commit
cd975c5f13
4 changed files with 63 additions and 5 deletions
|
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -131,6 +131,11 @@
|
|||
{{ form_label(form.isUnread) }}
|
||||
</div>
|
||||
|
||||
<div class="input-field col s6 with-checkbox">
|
||||
{{ form_widget(form.isAnnotated) }}
|
||||
{{ form_label(form.isAnnotated) }}
|
||||
</div>
|
||||
|
||||
<div class="col s12">
|
||||
<label>{{ 'entry.filters.preview_picture_help'|trans }}</label>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue