controller and templates adapted to display list of accompanying period tasks + detailpage of task

This commit is contained in:
2021-09-16 15:55:09 +02:00
parent b1dbd8b011
commit a156bd0863
8 changed files with 423 additions and 202 deletions

View File

@@ -0,0 +1,107 @@
{% if tasks|length > 0 %}
<h3>{{ title|trans }}</h3>
<table class="table table-bordered border-dark chill-task-list">
<tbody>
{% for task in tasks %}
<tr>
<td>
<div>
<span class="chill-task-list__row__title">{{ task.title }}</span>
</div>
<div>
<span class="chill-task-list__row__type">{{ task_workflow_metadata(task, 'definition.name')|trans }}</span>
</div>
<div>
{% for place in workflow_marked_places(task) %}
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
{% endfor %}
{% if task.assignee is not null %}
<div class="chill-task-list__row__assignee">
<span class="chill_task-list__row__assignee_by">{{ 'By'|trans }}&nbsp;:</span>
{{ task.assignee.username }}</div>
{% endif %}
</div>
{% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
<div class="chill-task-list__row__dates">
<ul class="record_actions column">
{% if task.startDate is not null %}
<li title="{{ 'Start'|trans|escape('html_attr') }}">
<i class="fa fa-play"></i>
{{ task.startDate|format_date('medium') }}
</li>
{% endif %}
{% if task.warningDate is not null %}
<li title="{{ 'Warning'|trans|escape('html_attr') }}">
<i class="fa fa-exclamation-triangle"></i>
{{ task.warningDate|format_date('medium') }}
</li>
{% endif %}
{% if task.endDate is not null %}
<li title="{{ 'End'|trans|escape('html_attr') }}">
<i class="fa fa-hourglass-end"></i>
{{ task.endDate|format_date('medium') }}
</li>
{% endif %}
</ul>
</div>
{% endif %}
</td>
<td>
<ul
class="record_actions">
{# {% if workflow_transitions(task)|length > 0 %}
<li>
<div class="btn-group">
<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button" id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
{{'Change task status'|trans}}
</a>
<ul class="dropdown-menu" aria-labelledby="taskExchange">
{% for transition in workflow_transitions(task) %}
<li>
<a class="dropdown-item" href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'list_params': app.request.query.all }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
</a>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endif %} #}
<li>
<a href="{{ path('chill_task_single_task_show', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-show "></a>
</li>
{# {% if is_granted('CHILL_TASK_TASK_UPDATE', task) %} #}
<li>
<a href="{{ path('chill_task_single_task_edit', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-update "></a>
</li>
{# {% endif %} #}
{# {% if is_granted('CHILL_TASK_TASK_DELETE', task) %} #}
<li>
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id, 'list_params': app.request.query.all } ) }}" class="btn btn-delete "></a>
</li>
{# {% endif %} #}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<ul class="record_actions">
<li>
{% if accompanyingCourse is not null %}
<a href="{{ path('chill_task_single_task_new', {'course_id': accompanyingCourse.id}) }}" class="btn btn-create">
{{ 'Add a new task' | trans }}
</a>
{% endif %}
</li>
</ul>

View File

@@ -0,0 +1,110 @@
<div class="task-show">
<h1>{{ 'Task'|trans }}</h1>
<h2>{{ task.title }}
{% for place in workflow_marked_places(task) %}
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
{% endfor %}
</h2>
<dl class="chill_view_data">
<dt class="inline">{{ 'Description'|trans }}</dt>
<dd>
{% if task.description is empty %}
<span class="chill-no-data-statement">{{"No description"|trans}}</span>
{% else %}
<blockquote class="chill-user-quote">
{{ task.description|chill_markdown_to_html }}
</blockquote>
{% endif %}
</dd>
<dt class="inline">{{ 'Assignee'|trans }}</dt>
<dd>
{% if task.assignee is null %}
<span class="chill-no-data-statement">{{"No one assignee"|trans}}</span>
{% else %}
{{ task.assignee }}
{% endif %}
</dd>
<dt class="inline">{{ 'Scope'|trans }}</dt>
<dd>
<span class="scope">{{ task.scope.name|localize_translatable_string }}</span>
</dd>
<h3>{{"Dates"|trans}}</h3>
{% if task.startDate is null and task.endDate is null and task.warningDate is null %}
<dt></dt>
<dd>
<span class="chill-no-data-statement">{{"No dates specified"|trans}}</span>
</dd>
</dt>
{% else %}
{% if task.startDate is not null %}
<dt class="inline">{{ 'Start'|trans }}</dt>
<dd>{{ task.startDate|format_date('long') }}</dd>
{% endif %}
{% if task.endDate is not null %}
<dt class="inline">{{ 'End'|trans }}</dt>
<dd>{{ task.endDate|format_date('long') }}</dd>
{% endif %}
{% if task.warningDate is not null %}
<dt class="inline">{{ 'Warning'|trans }}</dt>
<dd>{{ task.warningDate|format_date('long') }}</dd>
{% endif %}
{% endif %}
</dl>
{% if timeline is not null %}
<h3>{{"Timeline"|trans}}</h3>
{{ timeline|raw }}
{% endif %}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{%- if app.request.query.has('returnPath') -%} {{ app.request.query.get('returnPath')|escape('html_attr') }} {%- else -%} {{ path('chill_task_singletask_list', app.request.query.get('list_params', {}) ) }} {%- endif -%}">
{{ app.request.query.get('returnLabel')|default('Back to the list'|trans) }}
</a>
</li>
{% if workflow_transitions(task)|length > 0 %}
<li>
<div class="btn-group">
<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button" id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
{{'Change task status'|trans}}
</a>
<ul class="dropdown-menu" aria-labelledby="taskExchange">
{% for transition in workflow_transitions(task) %}
<li>
<a class="dropdown-item" href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
</a>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endif %}
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
<li>
<a class="btn btn-update" href="{{ path('chill_task_single_task_edit', { 'id': task.id }) }}">
{{ 'Edit the task'|trans }}
</a>
</li>
{% endif %}
{% if is_granted('CHILL_TASK_TASK_CREATE', task) %}
<li>
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id } ) }}" class="btn btn-delete">
{{ 'Delete'|trans }}
</a>
</li>
{% endif %}
</ul></div>

View File

@@ -37,7 +37,7 @@
{% else %}
{% block content %}
<div class="col-md-10 col-xxl tasks">
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
{% include 'ChillTaskBundle:SingleTask:_listCourse.html.twig' %}
</div>
{% endblock %}
{% endif %}

View File

@@ -16,124 +16,17 @@
#}
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_task_single_task_show' %}
{% set person = task.person %}
{% block title %}{{ 'Task'|trans }}{% endblock %}
{% block title %}
{{ 'Task'|trans }}
{% endblock %}
{% block personcontent %}
<div class="task-show">
<h1>{{ 'Task'|trans }}</h1>
<h2>{{ task.title }} {% for place in workflow_marked_places(task) %}
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
{% endfor %}</h2>
<dl class="chill_view_data">
<dt class="inline">{{ 'Description'|trans }}</dt>
<dd>
{% if task.description is empty %}
<span class="chill-no-data-statement">{{"No description"|trans}}</span>
{% else %}
<blockquote class="chill-user-quote">
{{ task.description|chill_markdown_to_html }}
</blockquote>
{% endif %}
</dd>
<dt class="inline">{{ 'Assignee'|trans }}</dt>
<dd>
{% if task.assignee is null %}
<span class="chill-no-data-statement">{{"No one assignee"|trans}}</span>
{% else %}
{{ task.assignee }}
{% endif %}
</dd>
<dt class="inline">{{ 'Scope'|trans }}</dt>
<dd><span class="scope">{{ task.scope.name|localize_translatable_string }}</span></dd>
<h3>{{"Dates"|trans}}</h3>
{% if task.startDate is null and task.endDate is null and task.warningDate is null %}
<dt>
<dd><span class="chill-no-data-statement">{{"No dates specified"|trans}}</span></dd>
</dt>
{% else %}
{% if task.startDate is not null %}
<dt class="inline">{{ 'Start'|trans }}</dt>
<dd>{{ task.startDate|format_date('long') }}</dd>
{% endif %}
{% if task.endDate is not null %}
<dt class="inline">{{ 'End'|trans }}</dt>
<dd>{{ task.endDate|format_date('long') }}</dd>
{% endif %}
{% if task.warningDate is not null %}
<dt class="inline">{{ 'Warning'|trans }}</dt>
<dd>{{ task.warningDate|format_date('long') }}</dd>
{% endif %}
{% endif %}
</dl>
{% if timeline is not null %}
<h3>{{"Timeline"|trans}}</h3>
{{ timeline|raw }}
{% endif %}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{%- if app.request.query.has('returnPath') -%}
{{ app.request.query.get('returnPath')|escape('html_attr') }}
{%- else -%}
{{ path('chill_task_singletask_list', app.request.query.get('list_params', {}) ) }}
{%- endif -%}">
{{ app.request.query.get('returnLabel')|default('Back to the list'|trans) }}
</a>
</li>
{% if workflow_transitions(task)|length > 0 %}
<li>
<div class="btn-group">
<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button"
id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
{{'Change task status'|trans}}
</a>
<ul class="dropdown-menu" aria-labelledby="taskExchange">
{% for transition in workflow_transitions(task) %}
<li>
<a class="dropdown-item"
href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
</a>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endif %}
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
<li>
<a class="btn btn-update" href="{{ path('chill_task_single_task_edit', { 'id': task.id }) }}">
{{ 'Edit the task'|trans }}
</a>
</li>
{% endif %}
{% if is_granted('CHILL_TASK_TASK_CREATE', task) %}
<li>
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id } ) }}" class="btn btn-delete">
{{ 'Delete'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
{% include 'ChillTaskBundle:SingleTask:_show.html.twig' %}
{% endblock %}

View File

@@ -0,0 +1,16 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_task_single_task_show' %}
{% set accompanyingCourse = task.course %}
{% block title %}
{{ 'Task'|trans }}
{% endblock %}
{% block content %}
{% include 'ChillTaskBundle:SingleTask:_show.html.twig' %}
{% endblock %}