Browse Source

Fix pagination for the News page

pull/684/head
Timothée Jaussoin 7 years ago
parent
commit
7f09bb9b6c
  1. 13
      app/widgets/Menu/Menu.php
  2. 29
      app/widgets/Menu/_menu_list.tpl

13
app/widgets/Menu/Menu.php

@ -4,7 +4,7 @@ include_once WIDGETS_PATH.'Post/Post.php';
class Menu extends \Movim\Widget\Base
{
private $_paging = 15;
private $_paging = 10;
function load()
{
@ -177,14 +177,15 @@ class Menu extends \Movim\Widget\Base
}
});
$next = $page + 1;
$view->assign('goback', $this->route('news', $next));
$view->assign('previous', $this->route('news', $page-1));
$view->assign('next', $this->route('news', $page+1));
if ($type == 'news') {
$view->assign('goback', $this->route('news', $next, [], 'communities'));
$view->assign('previous', $this->route('news', $page-1, [], 'communities'));
$view->assign('next', $this->route('news', $page+1, [], 'communities'));
} elseif ($type == 'feed') {
$view->assign('goback', $this->route('news', $next, [], 'contacts'));
$view->assign('previous', $this->route('news', $page-1, [], 'contacts'));
$view->assign('next', $this->route('news', $page+1, [], 'contacts'));
}
$view->assign('items', $items

29
app/widgets/Menu/_menu_list.tpl

@ -58,18 +58,23 @@
{autoescape="off"}{$c->preparePost($value)}{/autoescape}
</div>
{/loop}
{if="count($items) == $paging"}
<ul class="list active thick">
<a href="{$goback}">
<li id="history" class="large">
<span class="icon primary gray">
<i class="material-icons">history</i>
</span>
<p class="normal center line">{$c->__('post.older')}</p>
</li>
</a>
</ul>
{/if}
<ul class="list thick">
<li class="block">
<p class="center">
<a class="button flat {if="$page == 0"}disabled{/if}" href="{$previous}">
<i class="material-icons">keyboard_arrow_left</i>
{$c->__('button.previous')}
</a>
{if="count($items) == $paging"}
<a class="button flat" href="{$next}" title="{$c->__('post.older')}">
{$c->__('button.next')}
<i class="material-icons">keyboard_arrow_right</i>
</a>
{/if}
</p>
</li>
</ul>
</div>
{elseif="$page == 0"}

Loading…
Cancel
Save