aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-04-13 09:42:18 +0200
committerJeremy Benoist <j0k3r@users.noreply.github.com>2016-04-13 09:42:18 +0200
commita417b869237763ee115982d6367a82aa6174d74e (patch)
treea9f06adbb39609e98e15ace717db843bd718f2cb
parent245e2e2caed9445155de6c368ffcacf722b774b3 (diff)
parent18078ded1278af4d8352a0b71efbc48369a0da72 (diff)
downloadwallabag-a417b869237763ee115982d6367a82aa6174d74e.tar.gz
wallabag-a417b869237763ee115982d6367a82aa6174d74e.tar.zst
wallabag-a417b869237763ee115982d6367a82aa6174d74e.zip
Merge pull request #1918 from wallabag/improve-pagination
Improve pagination when user has lot of entries
-rw-r--r--app/AppKernel.php11
-rw-r--r--app/config/services.yml2
-rw-r--r--composer.json3
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml16
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css14
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/public/themes/material/css/main.css20
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig11
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig8
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php2
9 files changed, 49 insertions, 38 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 30ac7463..04f86eb7 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -22,19 +22,22 @@ class AppKernel extends Kernel
22 new Nelmio\ApiDocBundle\NelmioApiDocBundle(), 22 new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
23 new Nelmio\CorsBundle\NelmioCorsBundle(), 23 new Nelmio\CorsBundle\NelmioCorsBundle(),
24 new Liip\ThemeBundle\LiipThemeBundle(), 24 new Liip\ThemeBundle\LiipThemeBundle(),
25 new Wallabag\CoreBundle\WallabagCoreBundle(),
26 new Wallabag\ApiBundle\WallabagApiBundle(),
27 new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(), 25 new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
28 new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(), 26 new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
29 new FOS\OAuthServerBundle\FOSOAuthServerBundle(), 27 new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
30 new Wallabag\UserBundle\WallabagUserBundle(),
31 new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), 28 new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
32 new Scheb\TwoFactorBundle\SchebTwoFactorBundle(), 29 new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(), 30 new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
34 new Wallabag\ImportBundle\WallabagImportBundle(),
35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 31 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
36 new Craue\ConfigBundle\CraueConfigBundle(), 32 new Craue\ConfigBundle\CraueConfigBundle(),
37 new Lexik\Bundle\MaintenanceBundle\LexikMaintenanceBundle(), 33 new Lexik\Bundle\MaintenanceBundle\LexikMaintenanceBundle(),
34 new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
35
36 // wallabag bundles
37 new Wallabag\CoreBundle\WallabagCoreBundle(),
38 new Wallabag\ApiBundle\WallabagApiBundle(),
39 new Wallabag\UserBundle\WallabagUserBundle(),
40 new Wallabag\ImportBundle\WallabagImportBundle(),
38 new Wallabag\AnnotationBundle\WallabagAnnotationBundle(), 41 new Wallabag\AnnotationBundle\WallabagAnnotationBundle(),
39 ]; 42 ];
40 43
diff --git a/app/config/services.yml b/app/config/services.yml
index e0683ffc..480408d9 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -6,7 +6,7 @@ services:
6 filesystem_cache: 6 filesystem_cache:
7 class: Doctrine\Common\Cache\FilesystemCache 7 class: Doctrine\Common\Cache\FilesystemCache
8 arguments: 8 arguments:
9 - %kernel.cache_dir%/doctrine/metadata 9 - "%kernel.cache_dir%/doctrine/metadata"
10 10
11 twig.extension.text: 11 twig.extension.text:
12 class: Twig_Extensions_Extension_Text 12 class: Twig_Extensions_Extension_Text
diff --git a/composer.json b/composer.json
index df5e29d5..a430c59e 100644
--- a/composer.json
+++ b/composer.json
@@ -80,7 +80,8 @@
80 "craue/config-bundle": "~1.4", 80 "craue/config-bundle": "~1.4",
81 "mnapoli/piwik-twig-extension": "^1.0", 81 "mnapoli/piwik-twig-extension": "^1.0",
82 "lexik/maintenance-bundle": "~2.1", 82 "lexik/maintenance-bundle": "~2.1",
83 "ocramius/proxy-manager": "1.*" 83 "ocramius/proxy-manager": "1.*",
84 "white-october/pagerfanta-bundle": "^1.0"
84 }, 85 },
85 "require-dev": { 86 "require-dev": {
86 "doctrine/doctrine-fixtures-bundle": "~2.2", 87 "doctrine/doctrine-fixtures-bundle": "~2.2",
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index a36f3392..6dc1f1d7 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
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 { 515div.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 > * { 526div.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 { 531div.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 { 536div.pagination ul a:hover, div.pagination ul a:focus {
537 text-decoration: underline; 537 text-decoration: underline;
538 } 538}
539 539
540.pagination .disabled { 540div.pagination ul .disabled {
541 display: none; 541 display: none;
542} 542}
543 543
544.pagination .current { 544div.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..a3915b1d 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,18 @@ 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
108.pagination .disabled {
109 margin-right: 10px;
110 margin-left: 10px;
111}
112
93.page-footer .footer-copyright p { 113.page-footer .footer-copyright p {
94 display: inline; 114 display: inline;
95} 115}
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..04e51955 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
@@ -6,16 +6,9 @@
6 {% block pager %} 6 {% block pager %}
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, 'twitter_bootstrap_translated', {'proximity': 1}) }}
12
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> 12 </div>
20 </div> 13 </div>
21 {% endblock %} 14 {% endblock %}
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..05cab954 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, 'twitter_bootstrap_translated', {'proximity': 1}) }}
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..a3527898 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -522,7 +522,7 @@ class EntryControllerTest extends WallabagCoreTestCase
522 522
523 $client->submit($form, $data); 523 $client->submit($form, $data);
524 524
525 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&amp;entry_filter%5BreadingTime%5D%5Bright_number%5D='; 525 $parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&entry_filter%5BreadingTime%5D%5Bright_number%5D=';
526 526
527 $client->request('GET', 'unread/list'.$parameters); 527 $client->request('GET', 'unread/list'.$parameters);
528 528