aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-20 15:59:47 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-21 07:30:48 +0200
commit89659c9eae338cd29e5919b5ffde6924189a59ca (patch)
tree281d37681fb2ca8413f7c619cacdc356fe90c0a4
parent109d67dbb16478f927c3d6a46ab61ea9994aafae (diff)
downloadwallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.tar.gz
wallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.tar.zst
wallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.zip
filters: implement status filter and a new view (to display all entries)
-rw-r--r--composer.lock22
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php42
-rw-r--r--src/Wallabag/CoreBundle/Filter/EntryFilterType.php4
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/base.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig19
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig1
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js1
7 files changed, 77 insertions, 15 deletions
diff --git a/composer.lock b/composer.lock
index 559a08dc..59f3343e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3466,16 +3466,16 @@
3466 }, 3466 },
3467 { 3467 {
3468 "name": "phpunit/phpunit", 3468 "name": "phpunit/phpunit",
3469 "version": "4.8.4", 3469 "version": "4.8.5",
3470 "source": { 3470 "source": {
3471 "type": "git", 3471 "type": "git",
3472 "url": "https://github.com/sebastianbergmann/phpunit.git", 3472 "url": "https://github.com/sebastianbergmann/phpunit.git",
3473 "reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7" 3473 "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc"
3474 }, 3474 },
3475 "dist": { 3475 "dist": {
3476 "type": "zip", 3476 "type": "zip",
3477 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7", 3477 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b7417edaf28059ea63d86be941e6004dbfcc0cc",
3478 "reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7", 3478 "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc",
3479 "shasum": "" 3479 "shasum": ""
3480 }, 3480 },
3481 "require": { 3481 "require": {
@@ -3534,24 +3534,24 @@
3534 "testing", 3534 "testing",
3535 "xunit" 3535 "xunit"
3536 ], 3536 ],
3537 "time": "2015-08-15 04:21:23" 3537 "time": "2015-08-19 09:20:57"
3538 }, 3538 },
3539 { 3539 {
3540 "name": "phpunit/phpunit-mock-objects", 3540 "name": "phpunit/phpunit-mock-objects",
3541 "version": "2.3.6", 3541 "version": "2.3.7",
3542 "source": { 3542 "source": {
3543 "type": "git", 3543 "type": "git",
3544 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 3544 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
3545 "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" 3545 "reference": "5e2645ad49d196e020b85598d7c97e482725786a"
3546 }, 3546 },
3547 "dist": { 3547 "dist": {
3548 "type": "zip", 3548 "type": "zip",
3549 "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", 3549 "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a",
3550 "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", 3550 "reference": "5e2645ad49d196e020b85598d7c97e482725786a",
3551 "shasum": "" 3551 "shasum": ""
3552 }, 3552 },
3553 "require": { 3553 "require": {
3554 "doctrine/instantiator": "~1.0,>=1.0.2", 3554 "doctrine/instantiator": "^1.0.2",
3555 "php": ">=5.3.3", 3555 "php": ">=5.3.3",
3556 "phpunit/php-text-template": "~1.2", 3556 "phpunit/php-text-template": "~1.2",
3557 "sebastian/exporter": "~1.2" 3557 "sebastian/exporter": "~1.2"
@@ -3590,7 +3590,7 @@
3590 "mock", 3590 "mock",
3591 "xunit" 3591 "xunit"
3592 ], 3592 ],
3593 "time": "2015-07-10 06:54:24" 3593 "time": "2015-08-19 09:14:08"
3594 }, 3594 },
3595 { 3595 {
3596 "name": "sebastian/comparator", 3596 "name": "sebastian/comparator",
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index dc399b8a..4070a603 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -102,6 +102,48 @@ class EntryController extends Controller
102 } 102 }
103 103
104 /** 104 /**
105 * Shows all entries for current user.
106 *
107 * @param Request $request
108 * @param int $page
109 *
110 * @Route("/all/list/{page}", name="all", defaults={"page" = "1"})
111 *
112 * @return \Symfony\Component\HttpFoundation\Response
113 */
114 public function showAllAction(Request $request, $page)
115 {
116 $form = $this->get('form.factory')->create(new EntryFilterType());
117
118 $filterBuilder = $this->getDoctrine()
119 ->getRepository('WallabagCoreBundle:Entry')
120 ->findAllByUser($this->getUser()->getId());
121
122 if ($request->query->has($form->getName())) {
123 // manually bind values from the request
124 $form->submit($request->query->get($form->getName()));
125
126 // build the query from the given form object
127 $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder);
128 }
129
130 $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery());
131 $entries = new Pagerfanta($pagerAdapter);
132
133 $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage());
134 $entries->setCurrentPage($page);
135
136 return $this->render(
137 'WallabagCoreBundle:Entry:entries.html.twig',
138 array(
139 'form' => $form->createView(),
140 'entries' => $entries,
141 'currentPage' => $page,
142 )
143 );
144 }
145
146 /**
105 * Shows unread entries for current user. 147 * Shows unread entries for current user.
106 * 148 *
107 * @param Request $request 149 * @param Request $request
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
index 771daef1..ff51785b 100644
--- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
@@ -39,7 +39,9 @@ class EntryFilterType extends AbstractType
39 39
40 return $filterQuery->createCondition($expression); 40 return $filterQuery->createCondition($expression);
41 }, 41 },
42 )); 42 ))
43 ->add('isArchived', 'filter_checkbox')
44 ->add('isStarred', 'filter_checkbox');
43 } 45 }
44 46
45 public function getName() 47 public function getName()
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
index ac5d2bf9..3ad776b9 100644
--- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
@@ -71,7 +71,8 @@
71 <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> 71 <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
72 <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> 72 <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
73 <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> 73 <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
74 <li><a href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> 74 <li><a href="{{ path('all') }}"}>{% trans %}all{% endtrans %}</a></li>
75 <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li>
75 <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li> 76 <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li>
76 <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> 77 <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
77 <div id="search-form" class="messages info popup-form"> 78 <div id="search-form" class="messages info popup-form">
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 bd64067c..b45552f2 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
@@ -7,6 +7,8 @@
7 {% trans %}Starred{% endtrans %} 7 {% trans %}Starred{% endtrans %}
8 {% elseif currentRoute == 'archive' %} 8 {% elseif currentRoute == 'archive' %}
9 {% trans %}Archive{% endtrans %} 9 {% trans %}Archive{% endtrans %}
10 {% elseif currentRoute == 'all' %}
11 {% trans %}Filtered{% endtrans %}
10 {% else %} 12 {% else %}
11 {% trans %}Unread{% endtrans %} 13 {% trans %}Unread{% endtrans %}
12 {% endif %} 14 {% endif %}
@@ -59,12 +61,26 @@
59 61
60 <!-- Filters --> 62 <!-- Filters -->
61 <div id="filters" class="side-nav fixed right-aligned"> 63 <div id="filters" class="side-nav fixed right-aligned">
62 <form> 64 <form action="{{ path('all') }}">
63 65
64 <h4 class="center">{% trans %}Filters{% endtrans %}</h1> 66 <h4 class="center">{% trans %}Filters{% endtrans %}</h1>
65 67
66 <div class="row"> 68 <div class="row">
67 69
70
71 <div class="col s12">
72 <label>{% trans %}Status{% endtrans %}</label>
73 </div>
74 <div class="input-field col s6">
75 {{ form_widget(form.isArchived) }}
76 <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label>
77 </div>
78
79 <div class="input-field col s6">
80 {{ form_widget(form.isStarred) }}
81 <label for="entry_filter_isStarred">{% trans %}Starred{% endtrans %}</label>
82 </div>
83
68 <div class="col s12"> 84 <div class="col s12">
69 <label>{% trans %}Reading time in minutes{% endtrans %}</label> 85 <label>{% trans %}Reading time in minutes{% endtrans %}</label>
70 </div> 86 </div>
@@ -77,7 +93,6 @@
77 <label for="entry_filter_readingTime_right_number">{% trans %}to{% endtrans %}</label> 93 <label for="entry_filter_readingTime_right_number">{% trans %}to{% endtrans %}</label>
78 </div> 94 </div>
79 95
80
81 <div class="input-field col s6"> 96 <div class="input-field col s6">
82 {{ form_widget(form.domainName, {'type': 'text', 'attr' : {'placeholder': 'website.com'} }) }} 97 {{ form_widget(form.domainName, {'type': 'text', 'attr' : {'placeholder': 'website.com'} }) }}
83 <label for="entry_filter_domainName">{% trans %}Domain name{% endtrans %}</label> 98 <label for="entry_filter_domainName">{% trans %}Domain name{% endtrans %}</label>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index 1456d5dd..0ec2e082 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -42,6 +42,7 @@
42 <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> 42 <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
43 <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}starred{% endtrans %}</a></li> 43 <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}starred{% endtrans %}</a></li>
44 <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li> 44 <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li>
45 <li class="bold {% if currentRoute == 'all' %}active{% endif %}"><a class="waves-effect" href="{{ path('all') }}">{% trans %}all{% endtrans %}</a></li>
45 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> 46 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li>
46 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> 47 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
47 <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li> 48 <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js
index c0700c2c..d397f8e5 100755
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js
@@ -5,6 +5,7 @@ function init_filters() {
5 $('.button-collapse-right').sideNav({ edge: 'right' }); 5 $('.button-collapse-right').sideNav({ edge: 'right' });
6 $('#clear_form_filters').on('click', function(){ 6 $('#clear_form_filters').on('click', function(){
7 $('#filters input').val(''); 7 $('#filters input').val('');
8 $('#filters :checked').removeAttr('checked');
8 return false; 9 return false;
9 }); 10 });
10 } 11 }