diff options
Diffstat (limited to 'src/Wallabag')
7 files changed, 44 insertions, 42 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index cba58858..e6077707 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 5 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
6 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; | ||
7 | use Pagerfanta\Pagerfanta; | 6 | use Pagerfanta\Pagerfanta; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
@@ -253,13 +252,7 @@ class EntryController extends Controller | |||
253 | $entries = new Pagerfanta($pagerAdapter); | 252 | $entries = new Pagerfanta($pagerAdapter); |
254 | 253 | ||
255 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); | 254 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); |
256 | try { | 255 | $entries->setCurrentPage($page); |
257 | $entries->setCurrentPage($page); | ||
258 | } catch (OutOfRangeCurrentPageException $e) { | ||
259 | if ($page > 1) { | ||
260 | return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 302); | ||
261 | } | ||
262 | } | ||
263 | 256 | ||
264 | return $this->render( | 257 | return $this->render( |
265 | 'WallabagCoreBundle:Entry:entries.html.twig', | 258 | 'WallabagCoreBundle:Entry:entries.html.twig', |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index a36f3392..11d4d59b 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -3,14 +3,14 @@ services: | |||
3 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme | 3 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme |
4 | arguments: | 4 | arguments: |
5 | - "@security.token_storage" | 5 | - "@security.token_storage" |
6 | - %wallabag_core.theme% | 6 | - "%wallabag_core.theme%" |
7 | 7 | ||
8 | # custom form type | 8 | # custom form type |
9 | wallabag_core.form.type.config: | 9 | wallabag_core.form.type.config: |
10 | class: Wallabag\CoreBundle\Form\Type\ConfigType | 10 | class: Wallabag\CoreBundle\Form\Type\ConfigType |
11 | arguments: | 11 | arguments: |
12 | - %liip_theme.themes% | 12 | - "%liip_theme.themes%" |
13 | - %wallabag_core.languages% | 13 | - "%wallabag_core.languages%" |
14 | tags: | 14 | tags: |
15 | - { name: form.type } | 15 | - { name: form.type } |
16 | 16 | ||
@@ -32,7 +32,7 @@ services: | |||
32 | wallabag_core.table_prefix_subscriber: | 32 | wallabag_core.table_prefix_subscriber: |
33 | class: Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber | 33 | class: Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber |
34 | arguments: | 34 | arguments: |
35 | - %database_table_prefix% | 35 | - "%database_table_prefix%" |
36 | tags: | 36 | tags: |
37 | - { name: doctrine.event_subscriber } | 37 | - { name: doctrine.event_subscriber } |
38 | 38 | ||
@@ -92,10 +92,10 @@ services: | |||
92 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener | 92 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener |
93 | arguments: | 93 | arguments: |
94 | - "@doctrine.orm.entity_manager" | 94 | - "@doctrine.orm.entity_manager" |
95 | - %wallabag_core.theme% | 95 | - "%wallabag_core.theme%" |
96 | - %wallabag_core.items_on_page% | 96 | - "%wallabag_core.items_on_page%" |
97 | - %wallabag_core.rss_limit% | 97 | - "%wallabag_core.rss_limit%" |
98 | - %wallabag_core.language% | 98 | - "%wallabag_core.language%" |
99 | tags: | 99 | tags: |
100 | - { name: kernel.event_subscriber } | 100 | - { name: kernel.event_subscriber } |
101 | 101 | ||
@@ -114,3 +114,11 @@ services: | |||
114 | class: Wallabag\CoreBundle\Operator\Doctrine\Matches | 114 | class: Wallabag\CoreBundle\Operator\Doctrine\Matches |
115 | tags: | 115 | tags: |
116 | - { name: rulerz.operator, executor: rulerz.executor.doctrine, operator: matches, inline: true } | 116 | - { name: rulerz.operator, executor: rulerz.executor.doctrine, operator: matches, inline: true } |
117 | |||
118 | pagerfanta.view.wallabag_view: | ||
119 | class: Pagerfanta\View\OptionableView | ||
120 | arguments: | ||
121 | - "@pagerfanta.view.twitter_bootstrap" | ||
122 | - { proximity: 1 } | ||
123 | public: false | ||
124 | tags: [{ name: pagerfanta.view, alias: wallabag_view }] | ||
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css index 1cb2ddf3..ba430cc4 100755 --- a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css +++ b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css | |||
@@ -512,7 +512,7 @@ img.preview { | |||
512 | width: 50%; | 512 | width: 50%; |
513 | } | 513 | } |
514 | 514 | ||
515 | .pagination { | 515 | div.pagination ul { |
516 | text-align: right; | 516 | text-align: right; |
517 | margin-bottom:50px; | 517 | margin-bottom:50px; |
518 | } | 518 | } |
@@ -523,25 +523,25 @@ img.preview { | |||
523 | color: #999; | 523 | color: #999; |
524 | } | 524 | } |
525 | 525 | ||
526 | .pagination > * { | 526 | div.pagination ul > * { |
527 | display: inline-block; | 527 | display: inline-block; |
528 | margin-left: 0.5em; | 528 | margin-left: 0.5em; |
529 | } | 529 | } |
530 | 530 | ||
531 | .pagination a { | 531 | div.pagination ul a { |
532 | color: #999; | 532 | color: #999; |
533 | text-decoration: none; | 533 | text-decoration: none; |
534 | } | 534 | } |
535 | 535 | ||
536 | .pagination a:hover, .pagination a:focus { | 536 | div.pagination ul a:hover, div.pagination ul a:focus { |
537 | text-decoration: underline; | 537 | text-decoration: underline; |
538 | } | 538 | } |
539 | 539 | ||
540 | .pagination .disabled { | 540 | div.pagination ul .disabled { |
541 | display: none; | 541 | display: none; |
542 | } | 542 | } |
543 | 543 | ||
544 | .pagination .current { | 544 | div.pagination ul .current { |
545 | height: 25px; | 545 | height: 25px; |
546 | padding: 4px 8px; | 546 | padding: 4px 8px; |
547 | border: 1px solid #d5d5d5; | 547 | border: 1px solid #d5d5d5; |
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/material/css/main.css b/src/Wallabag/CoreBundle/Resources/public/themes/material/css/main.css index 96c38822..fb0f5776 100755 --- a/src/Wallabag/CoreBundle/Resources/public/themes/material/css/main.css +++ b/src/Wallabag/CoreBundle/Resources/public/themes/material/css/main.css | |||
@@ -80,6 +80,14 @@ main, #content, .valign-wrapper { | |||
80 | margin-bottom: 0; | 80 | margin-bottom: 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | .pagination { | ||
84 | float: right; | ||
85 | } | ||
86 | |||
87 | .pagination ul { | ||
88 | margin: 0 !important; | ||
89 | } | ||
90 | |||
83 | .pagination li { | 91 | .pagination li { |
84 | padding: 0; | 92 | padding: 0; |
85 | } | 93 | } |
@@ -90,6 +98,13 @@ main, #content, .valign-wrapper { | |||
90 | display: block; | 98 | display: block; |
91 | } | 99 | } |
92 | 100 | ||
101 | .pagination li.active span { | ||
102 | padding: 0px 10px; | ||
103 | height: 30px; | ||
104 | display: block; | ||
105 | color: #fff; | ||
106 | } | ||
107 | |||
93 | .page-footer .footer-copyright p { | 108 | .page-footer .footer-copyright p { |
94 | display: inline; | 109 | display: inline; |
95 | } | 110 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index 29cb9584..8114c703 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -7,16 +7,9 @@ | |||
7 | <div class="results"> | 7 | <div class="results"> |
8 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> | 8 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> |
9 | <div class="pagination"> | 9 | <div class="pagination"> |
10 | <a href="#" id="filter">{{ 'entry.filters.title'|trans }}</a> | 10 | <a href="#" id="filter">{{ 'entry.filters.title'|trans }}</a> |
11 | {% if entries is not empty %} | 11 | {{ pagerfanta(entries, 'wallabag_view') }} |
12 | – | 12 | </div> |
13 | {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %} | ||
14 | <li> | ||
15 | <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a> | ||
16 | </li> | ||
17 | {% endfor %} | ||
18 | {% endif %} | ||
19 | </div> | ||
20 | </div> | 13 | </div> |
21 | {% endblock %} | 14 | {% endblock %} |
22 | 15 | ||
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 74c2623e..f637136c 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 | |||
@@ -21,13 +21,7 @@ | |||
21 | <div class="nb-results left"> | 21 | <div class="nb-results left"> |
22 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} | 22 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} |
23 | </div> | 23 | </div> |
24 | <ul class="pagination right"> | 24 | {{ pagerfanta(entries, 'wallabag_view') }} |
25 | {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %} | ||
26 | <li class="{{ currentPage == p ? 'active':'waves-effect'}}"> | ||
27 | <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}">{{ p }}</a> | ||
28 | </li> | ||
29 | {% endfor %} | ||
30 | </ul> | ||
31 | </div> | 25 | </div> |
32 | {% endblock %} | 26 | {% endblock %} |
33 | <br /> | 27 | <br /> |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 46fbaf91..f15aaab1 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -225,8 +225,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
225 | 225 | ||
226 | $client->request('GET', '/all/list/900'); | 226 | $client->request('GET', '/all/list/900'); |
227 | 227 | ||
228 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 228 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); |
229 | $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl()); | ||
230 | } | 229 | } |
231 | 230 | ||
232 | /** | 231 | /** |