{% extends "base.html" %}
{% comment %}
Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% block content %}
<div class="card bg-white mb-3">
    <h3 class="card-header text-center">
        {{ title }}
    </h3>
    {% render_table table %}
    <div class="card-footer">
        {% if can_add_recipe %}
        <a class="btn btn-sm btn-success" href="{% url 'food:recipe_create' %}">{% trans "New recipe" %}</a>
        {% endif %}
        <a class="btn btn-sm btn-primary" href="{% url "food:food_list" %}">
          {% trans "Return to the food list" %}
        </a>
    </div>
</div>
{% endblock %}

{% block extrajavascript %}
<script type="text/javascript">
    $(".table-row").click(function () {
            window.document.location = $(this).data("href");
        });
</script>
{% endblock %}