Skip to content

Commit

Permalink
Merge pull request #75 from JavierJimenez/master
Browse files Browse the repository at this point in the history
Exception thrown in the SimpleThingsEntityAuditBundle:Audit:view_detail.html.twig template when the entity property is a array
  • Loading branch information
DavidBadura committed Nov 10, 2014
2 parents b00fb7c + e5b7a4b commit 37f8aea
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{% extends "SimpleThingsEntityAuditBundle::layout.html.twig" %}

{% macro showValue(value) %}
{% if value.timestamp is defined %}
{{ value|date('m/d/Y') }}
{% elseif value is iterable %}
<ul>
{% for element in value %}
<li>{{ element }}</li>
{% endfor %}
</ul>
{% else %}
{{ value }}
{% endif %}
{% endmacro %}

{% import _self as helper %}

{% block simplethings_entityaudit_content %}
<h1>Comparing {{ className }} with identifiers of {{ id }} between revisions {{ oldRev }} and {{ newRev }}</h1>

Expand All @@ -14,12 +30,18 @@
{% for field, value in diff %}
<tr>
<td>{{ field }}</td>
<td>{{ value.old }}</td>
<td>{{ value.same }}</td>
<td>{{ value.new }}</td>
<td>
{{ helper.showValue(value.old) }}
</td>
<td>
{{ helper.showValue(value.same) }}
</td>
<td>
{{ helper.showValue(value.new) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>

{% endblock simplethings_entityaudit_content %}
{% endblock simplethings_entityaudit_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<td>{{ field }}</td>
{% if value.timestamp is defined %}
<td>{{ value|date('m/d/Y') }}</td>
{% elseif value is iterable %}
<td>
<ul>
{% for element in value %}
<li>{{ element }}</li>
{% endfor %}
</ul>
</td>
{% else %}
<td>{{ value }}</td>
{% endif %}
Expand All @@ -24,3 +32,4 @@
</table>

{% endblock simplethings_entityaudit_content %}

0 comments on commit 37f8aea

Please sign in to comment.