aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2015-08-17 15:19:35 +0200
committerJeremy Benoist <j0k3r@users.noreply.github.com>2015-08-17 15:19:35 +0200
commit0a3a5f6cd702f224c97ce8decadccad5347bde2c (patch)
tree504bac1f5b9c1b57877df77cce27c1c6e93de09a /src/Wallabag
parentc37381b946e51fa1783a8b3c1dd3f1f535b8c393 (diff)
parentab2c93c7eb644f89c01793be2b9f097943b3b791 (diff)
downloadwallabag-0a3a5f6cd702f224c97ce8decadccad5347bde2c.tar.gz
wallabag-0a3a5f6cd702f224c97ce8decadccad5347bde2c.tar.zst
wallabag-0a3a5f6cd702f224c97ce8decadccad5347bde2c.zip
Merge pull request #1352 from wallabag/v2-fix-pagination
fix #1350: fix pagination with filters
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php22
3 files changed, 24 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
index 539c035f..a794df0e 100644
--- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
@@ -10,7 +10,7 @@
10 <div class="pagination"> 10 <div class="pagination">
11 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %} 11 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %}
12 <li> 12 <li>
13 <a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a> 13 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a>
14 </li> 14 </li>
15 {% endfor %} 15 {% endfor %}
16 </div> 16 </div>
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 7777dc7f..101f5939 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
@@ -22,7 +22,7 @@
22 <ul class="pagination right"> 22 <ul class="pagination right">
23 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %} 23 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %}
24 <li class="{{ currentPage == p ? 'active':'waves-effect'}}"> 24 <li class="{{ currentPage == p ? 'active':'waves-effect'}}">
25 <a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}" >{{ p }}</a> 25 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}">{{ p }}</a>
26 </li> 26 </li>
27 {% endfor %} 27 {% endfor %}
28 </div> 28 </div>
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 24848eb2..0bd18c44 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -259,4 +259,26 @@ class EntryControllerTest extends WallabagCoreTestCase
259 259
260 $this->assertCount(1, $crawler->filter('div[class=entry]')); 260 $this->assertCount(1, $crawler->filter('div[class=entry]'));
261 } 261 }
262
263 public function testPaginationWithFilter()
264 {
265 $this->logInAs('admin');
266 $client = $this->getClient();
267
268 $crawler = $client->request('GET', '/config');
269
270 $form = $crawler->filter('button[id=config_save]')->form();
271
272 $data = array(
273 'config[items_per_page]' => '1',
274 );
275
276 $client->submit($form, $data);
277
278 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&amp;entry_filter%5BreadingTime%5D%5Bright_number%5D=';
279
280 $crawler = $client->request('GET', 'unread/list'.$parameters);
281
282 $this->assertContains($parameters, $client->getResponse()->getContent());
283 }
262} 284}