{% extends 'base/one.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-sm table-hover">
        <thead>
        <tr>
            <th>Line</th>
            <th>Type</th>
            <th>Old</th>
            <th>New</th>
        </tr>
        </thead>
        <tbody>
        {% for line in diff %}
            <tr>
                <td>{{ line.line }}.</td>
                <td class="table-{{ line.type == 'insert' ? 'success' : (line.type == 'delete' ? 'danger' : 'info') }}">
                    {{ line.type }}
                </td>
                <td class="table-{{ line.type == 'insert' ? '' : (line.type == 'delete' ? 'danger' : 'info') }}">
                    {{ line.from }}
                </td>
                <td class="table-{{ line.type == 'insert' ? 'success' : (line.type == 'delete' ? '' : 'info') }}">
                    {{ line.to }}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}