thomas-claireau/PHP-P6-Openclassrooms

View on GitHub
templates/admin/figure/index.html.twig

Summary

Maintainability
Test Coverage
{% extends 'base.html.twig' %}

{% block title 'Gérer les figures' %}
{% block h1 'Gérer les figures' %}
{% block subtitle 'Snow Tricks' %}


{% block body %}
    <div class="container mt-4">

        <h1>
            Gérer les figures
        </h1>

        {% include "flash.html.twig" %}

        <table class="table table-striped">
            <thead>
                <tr>
                    <th>
                        Titre
                    </th>
                    <th>
                        Actions
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for figure in figures %}
                    <tr>
                        <td>
                            {{ figure.name }}
                        </td>
                        <td>
                            <a href="{{ path('admin.figure.edit', {id: figure.id}) }}" class="btn btn-secondary">
                                Modifier
                            </a>
                            <form method="post" action="{{ path('admin.figure.delete', {id: figure.id}) }}" style="display: inline-block" onsubmit="return confirm('Vous êtes sur le point de supprimer une figure. Êtes vous vraiment sûr ?')">
                                <input type="hidden" name="_method" value="DELETE">
                                <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ figure.id) }}">
                                <button class="btn btn-danger">
                                    Supprimer
                                </button>
                            </form>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>

        <div class="text-right">
            <a href="{{ path('admin.figure.new') }}" class="btn btn-primary">
                Créer une nouvelle figure
            </a>
        </div>

    </div>
{% endblock %}