From: Jeremy Benoist Date: Wed, 19 Aug 2015 09:19:43 +0000 (+0200) Subject: Merge pull request #1363 from wallabag/v2-add-date-filter-view X-Git-Tag: 2.0.0-alpha.0~26 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=a3b4e8a2c07d26ecb6196ac8b0be9764fd30cb93;hp=d5e9a99ce6367d93907b81950bf94f31df4f3707;p=github%2Fwallabag%2Fwallabag.git Merge pull request #1363 from wallabag/v2-add-date-filter-view add creation date filter view --- 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 @@ +
+ {{ form_widget(form.createdAt.left_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.left_date.vars.value} }) }} + +
+
+ {{ form_widget(form.createdAt.right_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.right_date.vars.value} }) }} + +
+
{% trans %}Clear{% endtrans %}
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 $this->assertEquals(403, $client->getResponse()->getStatusCode()); } - public function testFilterOnUnreadeView() + public function testFilterOnReadingTime() { $this->logInAs('admin'); $client = $this->getClient(); @@ -260,6 +260,35 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertCount(1, $crawler->filter('div[class=entry]')); } + public function testFilterOnCreationDate() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = array( + 'entry_filter[createdAt][left_date]' => date('d/m/Y'), + 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime("+1 day")) + ); + + $crawler = $client->submit($form, $data); + + $this->assertCount(4, $crawler->filter('div[class=entry]')); + + $data = array( + 'entry_filter[createdAt][left_date]' => '01/01/1970', + 'entry_filter[createdAt][right_date]' => '01/01/1970' + ); + + $crawler = $client->submit($form, $data); + + $this->assertCount(0, $crawler->filter('div[class=entry]')); + + } + public function testPaginationWithFilter() { $this->logInAs('admin');