diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2020-03-15 13:54:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-15 13:54:44 +0100 |
commit | f38b8f0d8671217efb818c964329ff0c529dfef8 (patch) | |
tree | 8bff1cbf3a716772cc52aa0146dcebd2e9d187aa /src/Wallabag | |
parent | ba820b12b691ecbbcc4a4c31ecb4dbeb084d27dd (diff) | |
parent | 80609790ca7e94a31bf3c770ad02d310c1022890 (diff) | |
download | wallabag-f38b8f0d8671217efb818c964329ff0c529dfef8.tar.gz wallabag-f38b8f0d8671217efb818c964329ff0c529dfef8.tar.zst wallabag-f38b8f0d8671217efb818c964329ff0c529dfef8.zip |
Merge pull request #4278 from wallabag/fix/4240
Fix entries export from search view
Diffstat (limited to 'src/Wallabag')
3 files changed, 36 insertions, 14 deletions
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 | |||
68 | ); | 68 | ); |
69 | 69 | ||
70 | $title = 'Tag ' . $tag->getLabel(); | 70 | $title = 'Tag ' . $tag->getLabel(); |
71 | } elseif ('search' === $category) { | ||
72 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); | ||
73 | $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); | ||
74 | |||
75 | $entries = $repository->getBuilderForSearchByUser( | ||
76 | $this->getUser()->getId(), | ||
77 | $searchTerm, | ||
78 | $currentRoute | ||
79 | )->getQuery() | ||
80 | ->getResult(); | ||
81 | |||
82 | $title = 'Search ' . $searchTerm; | ||
71 | } else { | 83 | } else { |
72 | $entries = $repository | 84 | $entries = $repository |
73 | ->$methodBuilder($this->getUser()->getId()) | 85 | ->$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 @@ | |||
96 | {% if tag is defined %} | 96 | {% if tag is defined %} |
97 | {% set currentTag = tag %} | 97 | {% set currentTag = tag %} |
98 | {% endif %} | 98 | {% endif %} |
99 | {% set exportSearchTerm = null %} | ||
100 | {% if searchTerm is defined %} | ||
101 | {% set exportSearchTerm = searchTerm %} | ||
102 | {% endif %} | ||
103 | {% set previousRoute = app.request.attributes.get('currentRoute') %} | ||
99 | <h2>{{ 'entry.list.export_title'|trans }}</h2> | 104 | <h2>{{ 'entry.list.export_title'|trans }}</h2> |
100 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> | 105 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> |
101 | <ul> | 106 | <ul> |
102 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} | 107 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %} |
103 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag }) }}">MOBI</a></li>{% endif %} | 108 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI</a></li>{% endif %} |
104 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag }) }}">PDF</a></li>{% endif %} | 109 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %} |
105 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag }) }}">JSON</a></li>{% endif %} | 110 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %} |
106 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag }) }}">CSV</a></li>{% endif %} | 111 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %} |
107 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag }) }}">TXT</a></li>{% endif %} | 112 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %} |
108 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag }) }}">XML</a></li>{% endif %} | 113 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %} |
109 | </ul> | 114 | </ul> |
110 | </aside> | 115 | </aside> |
111 | 116 | ||
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 @@ | |||
63 | {% if tag is defined %} | 63 | {% if tag is defined %} |
64 | {% set currentTag = tag.slug %} | 64 | {% set currentTag = tag.slug %} |
65 | {% endif %} | 65 | {% endif %} |
66 | {% set exportSearchTerm = null %} | ||
67 | {% if searchTerm is defined %} | ||
68 | {% set exportSearchTerm = searchTerm %} | ||
69 | {% endif %} | ||
70 | {% set previousRoute = app.request.attributes.get('currentRoute') %} | ||
66 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> | 71 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> |
67 | <ul> | 72 | <ul> |
68 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} | 73 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %} |
69 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag }) }}">MOBI</a></li>{% endif %} | 74 | {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI</a></li>{% endif %} |
70 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag }) }}">PDF</a></li>{% endif %} | 75 | {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %} |
71 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag }) }}">JSON</a></li>{% endif %} | 76 | {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %} |
72 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag }) }}">CSV</a></li>{% endif %} | 77 | {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %} |
73 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag }) }}">TXT</a></li>{% endif %} | 78 | {% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %} |
74 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag }) }}">XML</a></li>{% endif %} | 79 | {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %} |
75 | </ul> | 80 | </ul> |
76 | </div> | 81 | </div> |
77 | 82 | ||