Merge pull request #1363 from wallabag/v2-add-date-filter-view

add creation date filter view
This commit is contained in:
Jeremy Benoist 2015-08-19 11:19:43 +02:00
commit a3b4e8a2c0
2 changed files with 39 additions and 1 deletions

View file

@ -81,6 +81,15 @@
<label>{% trans %}Create at{% endtrans %}</label>
</div>
<div class="input-field col s6">
{{ form_widget(form.createdAt.left_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.left_date.vars.value} }) }}
<label for="entry_filter_createdAt_left_date" class="active">{% trans %}from{% endtrans %}</label>
</div>
<div class="input-field col s6">
{{ form_widget(form.createdAt.right_date, {'type': 'date', 'attr': {'class': 'datepicker', 'data-value': form.createdAt.right_date.vars.value} }) }}
<label for="entry_filter_createdAt_right_date" class="active">{% trans %}to{% endtrans %}</label>
</div>
<div class="col s6">
<a href="#!" class="center waves-effect waves-green btn-flat" id="clear_form_filters">{% trans %}Clear{% endtrans %}</a>
</div>

View file

@ -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');