aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php3
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php1
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntrySortType.php18
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig20
5 files changed, 27 insertions, 18 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 85e71116..6e56c237 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -532,6 +532,7 @@ 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 536
536 // defined as null by default because each repository method have the right field as default value too 537 // defined as null by default because each repository method have the right field as default value too
537 // like `getBuilderForStarredByUser` will have `starredAt` sort by default 538 // like `getBuilderForStarredByUser` will have `starredAt` sort by default
@@ -540,8 +541,6 @@ class EntryController extends Controller
540 $sortBy = $request->get('entry_sort')['sortType']; 541 $sortBy = $request->get('entry_sort')['sortType'];
541 } 542 }
542 543
543 $direction = isset($request->get('entry_sort')['sortOrder']) ? 'DESC' : 'ASC';
544
545 switch ($type) { 544 switch ($type) {
546 case 'search': 545 case 'search':
547 $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm, $currentRoute); 546 $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm, $currentRoute);
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 16ded948..06a91e1e 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -131,6 +131,7 @@ class TagController extends Controller
131 131
132 return $this->render('WallabagCoreBundle:Entry:entries.html.twig', [ 132 return $this->render('WallabagCoreBundle:Entry:entries.html.twig', [
133 'form' => null, 133 'form' => null,
134 'sortForm' => null,
134 'entries' => $entries, 135 'entries' => $entries,
135 'currentPage' => $page, 136 'currentPage' => $page,
136 'tag' => $tag, 137 'tag' => $tag,
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php b/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
index 2555f68d..ac251c5b 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntrySortType.php
@@ -2,8 +2,6 @@
2 2
3namespace Wallabag\CoreBundle\Form\Type; 3namespace Wallabag\CoreBundle\Form\Type;
4 4
5use Doctrine\ORM\EntityRepository;
6use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
7use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; 5use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
8use Symfony\Component\Form\AbstractType; 6use Symfony\Component\Form\AbstractType;
9use Symfony\Component\Form\FormBuilderInterface; 7use Symfony\Component\Form\FormBuilderInterface;
@@ -26,12 +24,20 @@ class EntrySortType extends AbstractType
26 public function buildForm(FormBuilderInterface $builder, array $options) 24 public function buildForm(FormBuilderInterface $builder, array $options)
27 { 25 {
28 $builder 26 $builder
29 ->add('sortOrder', CheckboxFilterType::class) 27 ->add('sortOrder', ChoiceFilterType::class, [
28 'choices' => [
29 'entry.sort.ascending' => 'asc',
30 'entry.sort.descending' => 'desc',
31 ],
32 'label' => 'entry.sort.order_label',
33 ])
30 ->add('sortType', ChoiceFilterType::class, [ 34 ->add('sortType', ChoiceFilterType::class, [
31 'choices' => [ 35 'choices' => [
32 'createdAt' => 'createdAt', 36 'entry.sort.by.creation_date' => 'createdAt',
33 'title' => 'title', 37 'entry.sort.by.starred_date' => 'starredAt',
34 'updatedAt' => 'updatedAt', 38 'entry.sort.by.archive_date' => 'archivedAt',
39 'entry.sort.by.title' => 'title',
40 'entry.sort.by.last_updated' => 'updatedAt',
35 ], 41 ],
36 'label' => 'entry.sort.status_label', 42 'label' => 'entry.sort.status_label',
37 ]) 43 ])
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index d5173707..99425d5a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -260,11 +260,12 @@ entry:
260 sort: 260 sort:
261 title: 'Sort options' 261 title: 'Sort options'
262 status_label: 'Sort by' 262 status_label: 'Sort by'
263 order_label: 'Order'
263 by: 264 by:
264 creation_date: 'Creation date' 265 creation_date: 'Creation date'
265 title: 'Title' 266 title: 'Title'
266 last_updated: 'Last updated' 267 last_updated: 'Last updated'
267 ascending: 'Asencending' 268 ascending: 'Ascending'
268 descending: 'Descending' 269 descending: 'Descending'
269 view: 270 view:
270 left_menu: 271 left_menu:
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 7706896f..505a739b 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,22 +211,24 @@
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="{{ path('all') }}"> 214 <form action="{{ previousRoute }}">
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">
218 <div class="input-field col s6 with-checkbox"> 218 <div class="col s12">
219 {{ form_widget(sortForm.sortType) }}
220 {{ form_label(sortForm.sortType) }} 219 {{ form_label(sortForm.sortType) }}
221 </div> 220 </div>
222 221
222 <div class="input-field col s12">
223 {{ form_widget(sortForm.sortType) }}
224 </div>
225
223 <div class="col s12"> 226 <div class="col s12">
224 <div class="switch"> 227 {{ form_label(sortForm.sortOrder) }}
225 <label>Ascendant 228 </div>
226 {{ form_widget(sortForm.sortOrder) }} <span class="lever"></span> 229
227 Descendant 230 <div class="input-field col s12">
228 </label> 231 {{ form_widget(sortForm.sortOrder) }}
229 </div>
230 </div> 232 </div>
231 233
232 <div class="col s12"> 234 <div class="col s12">