actions buttons, set return values in url

This commit is contained in:
Tchama 2019-01-21 15:42:25 +01:00
parent 91124893fd
commit 3c434852d5
5 changed files with 88 additions and 18 deletions

View File

@ -18,6 +18,7 @@ Moderator: Animateur
Details of an event: Détails d'un événement Details of an event: Détails d'un événement
New event: Nouvel événement New event: Nouvel événement
Back to the most recent events: Retour aux derniers événements Back to the most recent events: Retour aux derniers événements
Back to the person events: Retour aux événements de la personne
Event creation: Création d'un événement Event creation: Création d'un événement
Add an event: Ajouter un événement Add an event: Ajouter un événement
Event edit: Modifier un événement Event edit: Modifier un événement

View File

@ -26,8 +26,12 @@
<ul class="record_actions"> <ul class="record_actions">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_event_list_most_recent') }}" class="sc-button bt-cancel">
{{ 'Back to the most recent events'|trans }} {% set returnPath = app.request.get('return_path') %}
{% set returnLabel = app.request.get('return_label') %}
<a href="{{ returnPath |default( path('chill_event_list_most_recent') ) }}" class="sc-button bt-cancel">
{{ returnLabel |default('Back to the most recent events'|trans) }}
</a> </a>
</li> </li>
<li> <li>

View File

@ -45,8 +45,46 @@
<td> <td>
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
{% set returnLabel = 'Back to the person events'|trans %}
{# temporaire --
TODO corriger EventVoter.php pour régler les autorisations sur les boutons, puis remplacer ci-dessous par le code commenté #}
<a href="{{ path('chill_event__event_show', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-show"></a>
<div class="bt-dropdown">
<a href="" class="sc-button bt-update"></a>
<div class="bt-dropdown-content">
<a href="{{ path('chill_event__event_edit', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Event edit'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', {
'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Participation Edit'|trans }}
</a>
</div>
</div>
{#
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %} {% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %}
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-show"></a> <a href="{{ path('chill_event__event_show', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
} ) }}" class="sc-button bt-show"></a>
{% endif %} {% endif %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) {% if is_granted('CHILL_EVENT_UPDATE', participation.event)
@ -56,11 +94,18 @@
<a href="" class="sc-button bt-update"></a> <a href="" class="sc-button bt-update"></a>
<div class="bt-dropdown-content"> <div class="bt-dropdown-content">
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-update"> <a href="{{ path('chill_event__event_edit', {
{{ 'Event edit'|trans }} 'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Event edit'|trans }}
</a> </a>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id } ) }}" class="sc-button bt-update">
{{ 'Participation Edit'|trans }} <a href="{{ path('chill_event_participation_edit', {
'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Participation Edit'|trans }}
</a> </a>
</div> </div>
@ -68,17 +113,25 @@
{% else %} {% else %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) %} {% if is_granted('CHILL_EVENT_UPDATE', participation.event) %}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-update has-hidden"> <a href="{{ path('chill_event__event_edit', {
<span class="show-on-hover">{{ 'Event edit'|trans }}</span> 'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Event edit'|trans }}
</a> </a>
{% endif %} {% endif %}
{% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %} {% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id } ) }}" class="sc-button bt-update has-hidden"> <a href="{{ path('chill_event_participation_edit', {
<span class="show-on-hover">{{ 'Participation Edit'|trans }}</span> 'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Participation Edit'|trans }}
</a> </a>
{% endif %} {% endif %}
{% endif %} {% endif %}
#}
</li> </li>
</ul> </ul>
</td> </td>

View File

@ -34,6 +34,14 @@
</table> </table>
<ul class="record_actions"> <ul class="record_actions">
{% set returnPath = app.request.get('return_path') %}
{% set returnLabel = app.request.get('return_label') %}
{% if returnPath and returnLabel %}
<li class="cancel">
<a href="{{ returnPath }}" class="sc-button bt-cancel">{{ returnLabel }}</a>
</li>
{% endif %}
<li> <li>
<a href="{{ path('chill_event__event_edit', { 'event_id': event.id }) }}" class="sc-button bt-edit"> <a href="{{ path('chill_event__event_edit', { 'event_id': event.id }) }}" class="sc-button bt-edit">
{{ 'Edit'|trans }} {{ 'Edit'|trans }}

View File

@ -28,8 +28,12 @@
<ul class="record_actions"> <ul class="record_actions">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-cancel">
{{ 'Back to the event'|trans }} {% set returnPath = app.request.get('return_path') %}
{% set returnLabel = app.request.get('return_label') %}
<a href="{{ returnPath |default( path('chill_event__event_show', { 'event_id' : participation.event.id } )) }}" class="sc-button bt-cancel">
{{ returnLabel |default('Back to the event'|trans) }}
</a> </a>
</li> </li>
<li> <li>