aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-24 16:06:06 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2020-04-28 10:14:46 +0200
commit074110ca2dd3ba0d58f2fa93076933d06b46df77 (patch)
tree42b46f8058f78def2dff488725c9c1c3bed0d63f /src
parent9b5552290445b404e6de0595d7d27a2de824230a (diff)
downloadwallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.gz
wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.tar.zst
wallabag-074110ca2dd3ba0d58f2fa93076933d06b46df77.zip
First draft for tests
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php16
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig4
3 files changed, 13 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 6e56c237..56759adb 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -532,13 +532,17 @@ class EntryController extends Controller
532 $repository = $this->get('wallabag_core.entry_repository'); 532 $repository = $this->get('wallabag_core.entry_repository');
533 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); 533 $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
534 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : ''); 534 $currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
535 $direction = (null !== $request->query->get('entry_sort')['sortOrder'] ? $request->query->get('entry_sort')['sortOrder'] : 'asc'); 535 $direction = 'asc';
536
537 // defined as null by default because each repository method have the right field as default value too
538 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
539 $sortBy = null; 536 $sortBy = null;
540 if (\in_array($request->get('entry_sort')['sortType'], ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) { 537
541 $sortBy = $request->get('entry_sort')['sortType']; 538 if (null !== ($request->query->get('entry_sort'))) {
539 $direction = (null !== $request->query->get('entry_sort')['sortOrder'] ? $request->query->get('entry_sort')['sortOrder'] : 'asc');
540
541 // defined as null by default because each repository method have the right field as default value too
542 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
543 if (\in_array($request->get('entry_sort')['sortType'], ['id', 'title', 'createdAt', 'updatedAt', 'starredAt', 'archivedAt'], true)) {
544 $sortBy = $request->get('entry_sort')['sortType'];
545 }
542 } 546 }
543 547
544 switch ($type) { 548 switch ($type) {
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 99425d5a..c7699ef0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -267,6 +267,7 @@ entry:
267 last_updated: 'Last updated' 267 last_updated: 'Last updated'
268 ascending: 'Ascending' 268 ascending: 'Ascending'
269 descending: 'Descending' 269 descending: 'Descending'
270 sort: 'Sort'
270 view: 271 view:
271 left_menu: 272 left_menu:
272 back_to_top: 'Back to top' 273 back_to_top: 'Back to top'
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 505a739b..2c8224bb 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
@@ -211,7 +211,7 @@
211 <!-- Sort --> 211 <!-- Sort -->
212 {% if sortForm is not null %} 212 {% if sortForm is not null %}
213 <div id="sort" class="side-nav right-aligned"> 213 <div id="sort" class="side-nav right-aligned">
214 <form action="{{ previousRoute }}"> 214 <form>
215 <h4 class="center">{{ 'entry.sort.title'|trans }}</h4> 215 <h4 class="center">{{ 'entry.sort.title'|trans }}</h4>
216 216
217 <div class="row"> 217 <div class="row">
@@ -232,7 +232,7 @@
232 </div> 232 </div>
233 233
234 <div class="col s12"> 234 <div class="col s12">
235 <button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">{{ 'entry.filters.action.filter'|trans }}</button> 235 <button class="btn waves-effect waves-light" type="submit" id="submit-sort" value="sort">{{ 'entry.sort.action.sort'|trans }}</button>
236 </div> 236 </div>
237 </div> 237 </div>
238 </form> 238 </form>