#4 Account: more features to manage gists - fix

This commit is contained in:
Simon Vieille 2016-06-19 08:52:16 +02:00
parent f89e84585a
commit 430f364456
3 changed files with 6 additions and 11 deletions

View file

@ -81,7 +81,7 @@ form:
type: type:
label: 'Language: %value%' label: 'Language: %value%'
choice: choice:
all: 'Tous' all: 'All'
html: 'HTML' html: 'HTML'
xml: 'XML' xml: 'XML'
css: 'CSS' css: 'CSS'

View file

@ -69,9 +69,6 @@ class MyController extends Controller
} }
} }
$nextPage = min($page + 1, $gists->getLastPage());
$previousPage = max($page - 1, 1);
return $this->render( return $this->render(
'My/my.html.twig', 'My/my.html.twig',
array( array(
@ -80,8 +77,6 @@ class MyController extends Controller
'deleteForm' => $deleteForm->createView(), 'deleteForm' => $deleteForm->createView(),
'filterForm' => $filterForm->createView(), 'filterForm' => $filterForm->createView(),
'deleted' => !empty($deleted), 'deleted' => !empty($deleted),
'nextPage' => $nextPage,
'previousPage' => $previousPage,
) )
); );
} }

View file

@ -97,7 +97,7 @@
<ul class="pagination"> <ul class="pagination">
<li> <li>
{% set params = app.request.attributes.get('_route_params')|merge({page: 1}) %} {% set params = app.request.attributes.get('_route_params')|merge({page: 1}) %}
<a href="{{ path('my', params) }}" aria-label="Previous"> <a href="{{ path('my', params) }}">
<span aria-hidden="true"> <span aria-hidden="true">
<span class="glyphicon glyphicon-step-backward"></span> <span class="glyphicon glyphicon-step-backward"></span>
</span> </span>
@ -105,7 +105,7 @@
</li> </li>
<li> <li>
{% set params = app.request.attributes.get('_route_params')|merge({page: previousPage}) %} {% set params = app.request.attributes.get('_route_params')|merge({page: gists.previousPage}) %}
<a href="{{ path('my', params) }}"> <a href="{{ path('my', params) }}">
<span aria-hidden="true"> <span aria-hidden="true">
<span class="glyphicon glyphicon glyphicon-chevron-left"></span> <span class="glyphicon glyphicon glyphicon-chevron-left"></span>
@ -121,8 +121,8 @@
{% endfor %} {% endfor %}
<li> <li>
{% set params = app.request.attributes.get('_route_params')|merge({page: nextPage}) %} {% set params = app.request.attributes.get('_route_params')|merge({page: gists.nextPage}) %}
<a href="{{ path('my', params) }}" aria-label="Previous"> <a href="{{ path('my', params) }}">
<span aria-hidden="true"> <span aria-hidden="true">
<span class="glyphicon glyphicon glyphicon-chevron-right"></span> <span class="glyphicon glyphicon glyphicon-chevron-right"></span>
</span> </span>
@ -130,7 +130,7 @@
</li> </li>
<li> <li>
{% set params = app.request.attributes.get('_route_params')|merge({page: 1}) %} {% set params = app.request.attributes.get('_route_params')|merge({page: gists.lastPage}) %}
<a href="{{ path('my', params) }}"> <a href="{{ path('my', params) }}">
<span aria-hidden="true"> <span aria-hidden="true">
<span class="glyphicon glyphicon-step-forward"></span> <span class="glyphicon glyphicon-step-forward"></span>