add list by person, user and scope + formatting of submit button in edit

This commit is contained in:
nobohan
2018-04-26 21:54:49 +02:00
parent 4b391d03d5
commit bf0db0de3f
7 changed files with 243 additions and 130 deletions

View File

@@ -1,34 +1,4 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_task_single_task_new' %}
{% block title %}{{ 'Task list'|trans }}{% endblock %}
{% macro thead() %}
{% endmacro %}
{% macro row(task) %}
{% endmacro %}
{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person) %}
{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person, user) %}
{% if tasks|length > 0 %}
<h2>{{ title|trans }}</h2>
@@ -52,7 +22,7 @@
{% for place in workflow_marked_places(task) %}
<span class="">{{ place }}</span>
{% endfor %}
{% for transition in workflow_transitions(task) %}
<a href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" style="background-color: {{ task_workflow_metadata(task, 'transition.background-color', transition)|e('html_attr') }}; color: {{ task_workflow_metadata(task, 'transition.text-color', transition)|e('html_attr') }}">{{ task_workflow_metadata(task, 'transition.verb', transition) }}</a>
{% endfor %}
@@ -82,7 +52,7 @@
</tbody>
</table>
{% if isSingleStatus %}
{% if tasks|length > paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
@@ -91,23 +61,45 @@
<!-- lien retour -->
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_task_list_by_person', {'personId': person.id}) }}" class="sc-button bt-cancel">
{% if person is not null %}
<a href="{{ path('chill_task_singletask_list', {'personId': person.id}) }}" class="sc-button bt-cancel">
{{ 'Back to the list' | trans }}
</a>
{% endif %}
{% if user is not null %}
<a href="{{ path('chill_task_singletask_list') }}" class="sc-button bt-cancel">
{{ 'Back to the list' | trans }}
</a>
{% endif %}
</li>
<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 %}
{% if user is not null %}
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
</li>
</ul>
{% else %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_task_task_list_by_person', {'personId': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
{% if person is not null %}
<a href="{{ path('chill_task_singletask_list', {'personId': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
{{ 'See more' | trans }}
</a>
{% endif %}
{% if user is not null %}
<a href="{{ path('chill_task_singletask_list', {'status' : [ status ] }) }}" class="sc-button bt-cancel">
{{ 'See more' | trans }}
</a>
{% endif %}
</li>
</ul>
{% endif %}
@@ -116,9 +108,7 @@
{% import _self as helper %}
{# filter tasks #}
{% block personcontent %}
<h1>{{ 'Task list'|trans }}</h1>
{% if single_task_ended_tasks is defined %}
@@ -136,7 +126,7 @@
{% if single_task_not_started_tasks is defined %}
{{ helper.date_status('Tasks not started', single_task_not_started_tasks, single_task_not_started_count, single_task_not_started_paginator, 'not_started', isSingleStatus, person) }}
{% endif %}
{% if single_task_closed_tasks is defined %}
{{ helper.date_status('Closed', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }}
{% endif %}
@@ -144,11 +134,16 @@
{% if isSingleStatus == false %}
<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 %}
{% if user is not null %}
<a href="{{ path('chill_task_single_task_new') }}" class="sc-button bt-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -34,7 +34,6 @@
{{ form_row(form.endDate) }}
{{ form_row(form.warningInterval) }}
{{ form_widget(form) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_task_single_task_show', { 'id': task.id } ) }}" class="sc-button bt-cancel">
@@ -42,7 +41,7 @@
</a>
</li>
<li>
<button class="sc-button bt-update" type="submit">{{ 'Save task'|trans }}</button>
{{ form_widget(form.submit, { 'label': 'Save task', 'attr': {'class' : 'sc-button bt-update'}})}}
</li>
</ul>

View File

@@ -0,0 +1,43 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends layout %}
{% set activeRouteKey = 'chill_task_single_task_new' %}
{% block title %}{{ 'Task list'|trans }}{% endblock %}
{% macro thead() %}
{% endmacro %}
{% macro row(task) %}
{% endmacro %}
{# filter tasks #}
{% if person is not null and user is null %}
{% block personcontent %}
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
{% endblock %}
{% elseif user is not null and person is null %}
{% block content %}
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
{% endblock %}
{% endif %}