aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php4
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig9
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php31
3 files changed, 41 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 6944a686..93ce650e 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -265,7 +265,7 @@ class EntryController extends Controller
265 265
266 $this->get('session')->getFlashBag()->add( 266 $this->get('session')->getFlashBag()->add(
267 'notice', 267 'notice',
268 'Entry archived' 268 'Entry ' . ($entry->isArchived() ? 'archived' : 'unarchived')
269 ); 269 );
270 270
271 return $this->redirect($request->headers->get('referer')); 271 return $this->redirect($request->headers->get('referer'));
@@ -290,7 +290,7 @@ class EntryController extends Controller
290 290
291 $this->get('session')->getFlashBag()->add( 291 $this->get('session')->getFlashBag()->add(
292 'notice', 292 'notice',
293 'Entry starred' 293 'Entry ' . ($entry->isStarred() ? 'starred' : 'unstarred')
294 ); 294 );
295 295
296 return $this->redirect($request->headers->get('referer')); 296 return $this->redirect($request->headers->get('referer'));
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 29530e1b..41ce9eee 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');