aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2015-08-19 11:19:43 +0200
committerJeremy Benoist <j0k3r@users.noreply.github.com>2015-08-19 11:19:43 +0200
commita3b4e8a2c07d26ecb6196ac8b0be9764fd30cb93 (patch)
treeff233b5b76d07ca7aad0cb96ffa459b77804bf83 /src
parentd5e9a99ce6367d93907b81950bf94f31df4f3707 (diff)
parent3f357ee2412e8f25df8a2813e2ba8ff20fb02f89 (diff)
downloadwallabag-a3b4e8a2c07d26ecb6196ac8b0be9764fd30cb93.tar.gz
wallabag-a3b4e8a2c07d26ecb6196ac8b0be9764fd30cb93.tar.zst
wallabag-a3b4e8a2c07d26ecb6196ac8b0be9764fd30cb93.zip
Merge pull request #1363 from wallabag/v2-add-date-filter-view
add creation date filter view
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig9
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php31
2 files changed, 39 insertions, 1 deletions
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 d6dd7c37..813e80cb 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
@@ -81,6 +81,15 @@
81 <label>{% trans %}Create at{% endtrans %}</label> 81 <label>{% trans %}Create at{% endtrans %}</label>
82 </div> 82 </div>
83 83
84 <div class="input-field col s6">
85 {{ form_widget(form.createdAt.left_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.left_date.vars.value} }) }}
86 <label for="entry_filter_createdAt_left_date" class="active">{% trans %}from{% endtrans %}</label>
87 </div>
88 <div class="input-field col s6">
89 {{ form_widget(form.createdAt.right_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.right_date.vars.value} }) }}
90 <label for="entry_filter_createdAt_right_date" class="active">{% trans %}to{% endtrans %}</label>
91 </div>
92
84 <div class="col s6"> 93 <div class="col s6">
85 <a href="#!" class="center waves-effect waves-green btn-flat" id="clear_form_filters">{% trans %}Clear{% endtrans %}</a> 94 <a href="#!" class="center waves-effect waves-green btn-flat" id="clear_form_filters">{% trans %}Clear{% endtrans %}</a>
86 </div> 95 </div>
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 0bd18c44..87c16415 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -241,7 +241,7 @@ class EntryControllerTest extends WallabagCoreTestCase
241 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 241 $this->assertEquals(403, $client->getResponse()->getStatusCode());
242 } 242 }
243 243
244 public function testFilterOnUnreadeView() 244 public function testFilterOnReadingTime()
245 { 245 {
246 $this->logInAs('admin'); 246 $this->logInAs('admin');
247 $client = $this->getClient(); 247 $client = $this->getClient();
@@ -260,6 +260,35 @@ class EntryControllerTest extends WallabagCoreTestCase
260 $this->assertCount(1, $crawler->filter('div[class=entry]')); 260 $this->assertCount(1, $crawler->filter('div[class=entry]'));
261 } 261 }
262 262
263 public function testFilterOnCreationDate()
264 {
265 $this->logInAs('admin');
266 $client = $this->getClient();
267
268 $crawler = $client->request('GET', '/unread/list');
269
270 $form = $crawler->filter('button[id=submit-filter]')->form();
271
272 $data = array(
273 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
274 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime("+1 day"))
275 );
276
277 $crawler = $client->submit($form, $data);
278
279 $this->assertCount(4, $crawler->filter('div[class=entry]'));
280
281 $data = array(
282 'entry_filter[createdAt][left_date]' => '01/01/1970',
283 'entry_filter[createdAt][right_date]' => '01/01/1970'
284 );
285
286 $crawler = $client->submit($form, $data);
287
288 $this->assertCount(0, $crawler->filter('div[class=entry]'));
289
290 }
291
263 public function testPaginationWithFilter() 292 public function testPaginationWithFilter()
264 { 293 {
265 $this->logInAs('admin'); 294 $this->logInAs('admin');