An activity may have multiple reasons

The relationship between Activity and Reasons is now many-to-many.

Some improvement in show activity layout.

refs #4 #7
This commit is contained in:
2016-02-22 14:48:35 +01:00
parent 65e7a130c5
commit c60d6acf97
11 changed files with 197 additions and 39 deletions

View File

@@ -16,6 +16,8 @@
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
{% set activeRouteKey = 'chill_activity_activity_list' %}
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
@@ -26,10 +28,9 @@
<tr>
<th class="chill-red">{{'Date' | trans }}</th>
<th class="chill-green">{{'Duration Time' | trans }}</th>
<th class="chill-orange">{{'Reason' | trans}}</th>
<th class="chill-orange">{{'Reasons' | trans}}</th>
<th>{{'Type' | trans}}</th>
<th></th>
<th></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@@ -37,13 +38,22 @@
<tr>
<td>{% if activity.date %}{{ activity.date|localizeddate('long', 'none') }}{% endif %}</td>
<td>{{ activity.durationTime|date('H:i') }}</td>
<td>{{ activity.reason.name | localize_translatable_string }}</td>
<td>
{%- if activity.reasons is empty -%}
{{ 'No reason associated'|trans }}
{%- else -%}
{% for r in activity.reasons %}{{ m.reason(r) }} {% endfor %}
{%- endif -%}
</td>
<td>{{ activity.type.name | localize_translatable_string }}</td>
<td>
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button black">{{ 'Show' | trans }}</a>
</td>
<td>
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update">{{ 'Edit' | trans }}</a>
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button">{{ 'show'|trans|capitalize }}</a>
</li>
<li>
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update">{{ 'Edit' | trans }}</a>
</li>
</td>
</tr>
{% endfor %}