add a button 'new task' in page head and improve voter

This commit is contained in:
2018-07-05 15:33:35 +02:00
parent 9852430b13
commit 066efdc042
3 changed files with 43 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person, user) %}
{% if tasks|length > 0 %}
<h2>{{ title|trans }}</h2>
<h3>{{ title|trans }}</h3>
<table class="records_list">
<thead>
@@ -141,10 +141,10 @@
{% import _self as helper %}
<h1>{{ 'Task list'|trans }}</h1>
<h1>{{ app.request.title|default('Task list')|trans }}</h1>
{% if false == app.request.query.boolean('hide_form', false) %}
<h3>{{ 'Filter the tasks'|trans }}</h3>
<h2>{{ 'Filter the tasks'|trans }}</h2>
{{ form_start(form) }}
{{ form_row(form.user_id) }}
@@ -168,18 +168,32 @@
{% if tasks_count == 0 %}
<p class="chill-no-data-statement">{{ "There is no tasks."|trans }}</p>
{% if person is not null %}
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
<ul class="record_actions">
<li>
{% if person is not null %}
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
</li>
</ul>
{% endif %}
<!-- Pour l'instant, il n'est pas encore possible d'ajouter une tache sans personne liée -->
<!-- {% if person is null %}
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %} -->
{% else %}
<h2>{{ 'Tasks'|trans }}</h2>
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
<ul class="record_actions">
<li>
{% if person is not null %}
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
</li>
</ul>
{% endif %}
{% if single_task_ended_tasks is defined %}
{{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }}
@@ -204,17 +218,11 @@
{% if isSingleStatus == false %}
<ul class="record_actions">
<li>
{% if person is not null %}
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
<!-- Pour l'instant, il n'est pas encore possible d'ajouter une tache sans personne liée -->
<!-- {% if person is null %}
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %} -->
</li>
</ul>
{% endif %}