Skip to content

Commit

Permalink
Merge pull request #459 from hossam-magdy/master
Browse files Browse the repository at this point in the history
Update README for bootstrap 4 template & Update the template for `align` viewParameter (center|right)
  • Loading branch information
nicolasmure authored Nov 27, 2017
2 parents 4ba34b5 + 524004e commit e946edd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ knp_paginator:
There are a few additional pagination templates, that could be used out of the box in `knp_paginator.template.pagination` key:

* `@KnpPaginator/Pagination/sliding.html.twig` (by default)
* `@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig`
* `@KnpPaginator/Pagination/twitter_bootstrap_v3_pagination.html.twig`
* `@KnpPaginator/Pagination/twitter_bootstrap_pagination.html.twig`
* `@KnpPaginator/Pagination/foundation_v5_pagination.html.twig`
Expand Down
18 changes: 18 additions & 0 deletions Resources/doc/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ If you need custom parameters in pagination template, use:
<?php
// set an array of custom parameters
$pagination->setCustomParameters(array(
'align' => 'center', # center|right (for template: twitter_bootstrap_v4_pagination)
'style' => 'bottom',
'span_class' => 'whatever'
));
Expand Down Expand Up @@ -135,3 +136,20 @@ $pagination = $paginator->paginate(
);
```

Or even in Twig:

```jinja
{{ knp_pagination_render(
pagination,
'@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig',
{
'queryParam1': 'param1 value',
'queryParam2': 'param2 value'
},
{
'viewParam1': 'param1 value',
'viewParam2': 'param2 value'
},
) }}
```

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{#
/**
* @file
* Twitter Bootstrap v4-alpha.6 Sliding pagination control implementation.
* Twitter Bootstrap v4-beta.2 Sliding pagination control implementation.
*
* View that can be used with the pagination module
* from the Twitter Bootstrap CSS Toolkit
* https://v4-alpha.getbootstrap.com/components/pagination/
* https://getbootstrap.com/docs/4.0/components/pagination/
*
*/
#}
{% if pageCount > 1 %}
<nav>
<ul class="pagination">
<ul class="pagination{{ (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') }}">

{% if previous is defined %}
<li class="page-item">
Expand Down

0 comments on commit e946edd

Please sign in to comment.