{% extends 'base.html.twig' %}

{% block body %}
    <h1>Questions list</h1>

    <table>
        <thead>
            <tr>
                <th>Id</th>
                <th>Title</th>
                <th>Createdat</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
        {% for question in questions %}
            <tr>
                <td><a href="{{ path('question_show', { 'id': question.id }) }}">{{ question.id }}</a></td>
                <td>{{ question.title }}</td>
                <td>{% if question.createdAt %}{{ question.createdAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                <td>
                    <ul>
                        <li>
                            <a href="{{ path('question_show', { 'id': question.id }) }}">show</a>
                        </li>
                        <li>
                            <a href="{{ path('question_edit', { 'id': question.id }) }}">edit</a>
                        </li>
                    </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <ul>
        <li>
            <a href="{{ path('question_new') }}">Create a new question</a>
        </li>
    </ul>
{% endblock %}
