From 93c5b47e8891282693cc8bb1fedfb4af06d699b0 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Tue, 4 Feb 2020 22:19:45 +0100 Subject: ExportController: fix entries export from search view Fixes #4240 Signed-off-by: Kevin Decherf --- .../CoreBundle/Controller/ExportController.php | 12 ++++++++++++ .../views/themes/baggy/Entry/entries.html.twig | 19 ++++++++++++------- .../views/themes/material/Entry/entries.html.twig | 19 ++++++++++++------- 3 files changed, 36 insertions(+), 14 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 282fd733..cec8d499 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -68,6 +68,18 @@ class ExportController extends Controller ); $title = 'Tag ' . $tag->getLabel(); + } elseif ('search' === $category) { + $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); + $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); + + $entries = $repository->getBuilderForSearchByUser( + $this->getUser()->getId(), + $searchTerm, + $currentRoute + )->getQuery() + ->getResult(); + + $title = 'Search ' . $searchTerm; } else { $entries = $repository ->$methodBuilder($this->getUser()->getId()) 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 b747ed84..4182628f 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 @@ -96,16 +96,21 @@ {% if tag is defined %} {% set currentTag = tag %} {% endif %} + {% set exportSearchTerm = null %} + {% if searchTerm is defined %} + {% set exportSearchTerm = searchTerm %} + {% endif %} + {% set previousRoute = app.request.attributes.get('currentRoute') %}

{{ 'entry.list.export_title'|trans }}

× 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 3906e1e0..0c21dc5d 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 @@ -63,15 +63,20 @@ {% if tag is defined %} {% set currentTag = tag.slug %} {% endif %} + {% set exportSearchTerm = null %} + {% if searchTerm is defined %} + {% set exportSearchTerm = searchTerm %} + {% endif %} + {% set previousRoute = app.request.attributes.get('currentRoute') %}

{{ 'entry.list.export_title'|trans }}

-- cgit v1.2.3