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" %}
{% set activeRouteKey = 'chill_event__list_by_person' %}
{% block title %}{{ 'Events participation' |trans }}{% endblock title %}
@ -38,11 +37,7 @@
<tbody>
{% for participation in participations %}
<tr>
<td>
<a href="{{ path('chill_event__event_show', { 'event_id': participation.event.id }) }}">
{{ participation.event.name }}
</a>
</td>
<td>{{ participation.event.name }}</td>
<td>{{ participation.event.date|localizeddate('long', 'short') }}</td>
<td>{{ participation.event.type.name|localize_translatable_string }}</td>
<td>{{ participation.role.name|localize_translatable_string }}</td>
@ -50,20 +45,39 @@
<td>
<ul class="record_actions">
<li>
{% 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">
{{ 'See'|trans }}
</a>
{% 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>
{% 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">
{{ 'Edit'|trans }}
</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-edit">
{{ 'Edit'|trans }}
</a>
{% if is_granted('CHILL_EVENT_UPDATE', participation.event)
and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<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 } ) }}" 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 %}
</li>
</ul>
@ -73,23 +87,12 @@
</tbody>
</table>
{% if participations|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% 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 %}

View File

@ -27,7 +27,7 @@
{{ form_row(form.status) }}
<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">
{{ 'Back to the event'|trans }}
</a>

View File

@ -32,7 +32,7 @@
<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">
<i class="fa fa-arrow-left"></i>
{{ 'Back to the event'|trans }}