mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 14:06:13 +00:00
add pagination to timeline
This commit is contained in:
parent
f6e91e6f77
commit
0031597e88
@ -43,11 +43,27 @@ class TimelinePersonController extends Controller
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
/* @var $timelineBuilder \Chill\MainBundle\Timeline\TimelineBuilder */
|
||||
$timelineBuilder = $this->get('chill.main.timeline_builder');
|
||||
$paginatorFactory = $this->get('chill_main.paginator_factory');
|
||||
|
||||
$nbItems = $timelineBuilder->countItems('person',
|
||||
[ 'person' => $person ]
|
||||
);
|
||||
|
||||
$paginator = $paginatorFactory->create($nbItems);
|
||||
|
||||
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
||||
(
|
||||
'timeline' => $this->get('chill.main.timeline_builder')
|
||||
->getTimelineHTML('person', array('person' => $person)),
|
||||
'person' => $person
|
||||
'timeline' => $timelineBuilder->getTimelineHTML(
|
||||
'person',
|
||||
array('person' => $person),
|
||||
$paginator->getCurrentPage()->getFirstItemNumber(),
|
||||
$paginator->getItemsPerPage()
|
||||
),
|
||||
'person' => $person,
|
||||
'nb_items' => $nbItems,
|
||||
'paginator' => $paginator
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -29,4 +29,7 @@ This view should receive those arguments:
|
||||
{% block personcontent %}
|
||||
{{ timeline|raw }}
|
||||
|
||||
{% if nb_items > paginator.getItemsPerPage %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
{% endblock personcontent %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user