From 7d5e57b35b4eca07417c296c156edb3b88eef90b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Sep 2014 09:15:19 +0200 Subject: Load $nb/2 articles when articles are unfolded See https://github.com/marienfressinaud/FreshRSS/issues/559 --- app/Controllers/indexController.php | 5 +++++ app/layout/layout.phtml | 1 + app/views/helpers/pagination.phtml | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index b0b051119..1d74a570b 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -83,6 +83,11 @@ class FreshRSS_index_Controller extends Minz_ActionController { $nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page); $first = Minz_Request::param ('next', ''); + $ajax_request = Minz_Request::param('ajax', false); + if ($ajax_request == 1 && $this->view->conf->display_posts) { + $nb = max(1, round($nb / 2)); + } + if ($this->view->state === FreshRSS_Entry::STATE_NOT_READ) { //Any unread article in this category at all? switch ($getType) { case 'a': diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 96a88d245..f95f45b5e 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -13,6 +13,7 @@ if (!empty($this->nextId)) { $params = Minz_Request::params(); $params['next'] = $this->nextId; + $params['ajax'] = 1; ?> diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml index f6fcbc701..1b15cc632 100755 --- a/app/views/helpers/pagination.phtml +++ b/app/views/helpers/pagination.phtml @@ -9,7 +9,10 @@