improve actions buttons display for granted cases

This commit is contained in:
Tchama 2019-01-21 10:38:43 +01:00
parent f71e273aae
commit 91124893fd
3 changed files with 36 additions and 33 deletions

View File

@ -16,7 +16,6 @@
#} #}
{% extends "ChillPersonBundle::layout.html.twig" %} {% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_event__list_by_person' %} {% set activeRouteKey = 'chill_event__list_by_person' %}
{% block title %}{{ 'Events participation' |trans }}{% endblock title %} {% block title %}{{ 'Events participation' |trans }}{% endblock title %}
@ -38,11 +37,7 @@
<tbody> <tbody>
{% for participation in participations %} {% for participation in participations %}
<tr> <tr>
<td> <td>{{ participation.event.name }}</td>
<a href="{{ path('chill_event__event_show', { 'event_id': participation.event.id }) }}">
{{ participation.event.name }}
</a>
</td>
<td>{{ participation.event.date|localizeddate('long', 'short') }}</td> <td>{{ participation.event.date|localizeddate('long', 'short') }}</td>
<td>{{ participation.event.type.name|localize_translatable_string }}</td> <td>{{ participation.event.type.name|localize_translatable_string }}</td>
<td>{{ participation.role.name|localize_translatable_string }}</td> <td>{{ participation.role.name|localize_translatable_string }}</td>
@ -50,20 +45,39 @@
<td> <td>
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{% 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 black"> <a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-show"></a>
{{ 'See'|trans }}
</a>
{% endif %} {% endif %}
{% 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"> {% if is_granted('CHILL_EVENT_UPDATE', participation.event)
{{ 'Edit'|trans }} and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
</a>
{% endif %} <div class="bt-dropdown">
{% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %} <a href="" class="sc-button bt-update"></a>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id } ) }}" class="sc-button bt-edit"> <div class="bt-dropdown-content">
{{ 'Edit'|trans }}
</a> <a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-update">
{{ 'Event edit'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id } ) }}" class="sc-button bt-update">
{{ 'Participation Edit'|trans }}
</a>
</div>
</div>
{% else %}
{% 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">
<span class="show-on-hover">{{ 'Event edit'|trans }}</span>
</a>
{% endif %}
{% 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">
<span class="show-on-hover">{{ 'Participation Edit'|trans }}</span>
</a>
{% endif %}
{% endif %} {% endif %}
</li> </li>
</ul> </ul>
@ -73,23 +87,12 @@
</tbody> </tbody>
</table> </table>
{% if participations|length < paginator.getTotalItems %} {% if participations|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }} {{ chill_pagination(paginator) }}
{% endif %} {% endif %}
{# {#
<pre>
/!\ dev notes
=============
- problème de cohérence avec le bouton voir et avec le bouton modifier
- checker les autorisations pour les boutons
- affichage différencié pour les événements passés/présents/futur
- person menu, utiliser authorizationHelper ou authorizationChecker ??
</pre>
{{ dump() }}
#} #}
{{ dump() }}
{% endblock %} {% endblock %}

View File

@ -27,7 +27,7 @@
{{ form_row(form.status) }} {{ form_row(form.status) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-cancel"> <a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button bt-cancel">
{{ 'Back to the event'|trans }} {{ 'Back to the event'|trans }}
</a> </a>

View File

@ -32,7 +32,7 @@
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button btn-cancel"> <a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button btn-cancel">
<i class="fa fa-arrow-left"></i> <i class="fa fa-arrow-left"></i>
{{ 'Back to the event'|trans }} {{ 'Back to the event'|trans }}