Add compare function between snipsContents

This commit is contained in:
Tim
2025-04-23 21:27:47 +02:00
parent 28a2706525
commit cc3e050304
6 changed files with 179 additions and 22 deletions

View File

@ -0,0 +1,38 @@
{% extends 'base/single.column.html.twig' %}
{% set title = 'Snip compare ' ~ snip %}
{% block body %}
<a href="{{ path('snip_single', {snip: snip.id}) }}" class="btn btn-primary">
<i class="fa fa-arrow-left"></i> Back
</a>
<br><br>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Line</th>
<th>Old</th>
<th>New</th>
</tr>
</thead>
<tbody>
{% for line in diff %}
<tr>
<td class="table-{{ line.type == 'insert' ? 'success' : (line.type == 'delete' ? 'danger' : 'info') }}">
{{ line.type }}
</td>
<td>
{% if line.from %}
{{ line.from }}
{% endif %}
</td>
<td>
{% if line.to %}
{{ line.to }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}