{% extends "base.html" %} {% block content %}
{% if request.args.get('pantry_mode') == 'on' %} {% endif %} {% if request.args.get('dietary_vegan') %}{% endif %} {% if request.args.get('dietary_vegetarian') %}{% endif %} {% if request.args.get('dietary_gluten_free') %}{% endif %} {% if request.args.get('dietary_dairy_free') %}{% endif %} {% if request.args.get('dietary_nut_free') %}{% endif %} {% if request.args.get('dietary_halal') %}{% endif %}
{% set menu_open = request.args.get('pantry_mode') == 'on' or selected_ids or request.args.get('keep_menu') == '1' %}
{% if request.args.get('pantry_mode') == 'on' %} Pantry Mode {% endif %} {{ total_count }} recipe{{ 's' if total_count != 1 }} {% if total_pages > 1 %} — page {{ page }} of {{ total_pages }}{% endif %}
{% if request.args.get('q') or selected_ids or request.args.get('cuisine') or request.args.get('culinary_type') or request.args.getlist('tag') or request.args.get('dietary_vegan') or request.args.get('dietary_vegetarian') or request.args.get('dietary_gluten_free') or request.args.get('dietary_dairy_free') or request.args.get('dietary_nut_free') or request.args.get('dietary_halal') %} Clear All {% endif %}
{# ── RECIPE GRID — display-aware ── #} {% if display == 'list' %}
{% for recipe in recipes %}
{% if recipe.image_filename %} {% else %}
{% endif %}
{{ recipe.title }}
{% if recipe.prep_time %}{{ recipe.prep_time }}m prep{% endif %} {% if recipe.cook_time %}{{ recipe.cook_time }}m cook{% endif %} {% if recipe.servings %}{{ recipe.servings }} serv{% endif %} {% if recipe.cuisine %}{{ recipe.cuisine }}{% endif %} {% if recipe.culinary_type %}{{ recipe.culinary_type }}{% endif %}
{% if recipe.recipe_tags %}
{% for rt in recipe.recipe_tags[:4] %}{{ rt.tag.name }}{% endfor %}
{% endif %}
{% endfor %}
{% elif display == 'small' %} {% elif display == 'big' %}
{% for recipe in recipes %}
{% if recipe.image_filename %} {% else %}
{% endif %}
{{ recipe.title }}
{% if recipe.description %}

{{ recipe.description }}

{% endif %}
{% if recipe.prep_time %}{{ recipe.prep_time }}m prep{% endif %} {% if recipe.cook_time %}{{ recipe.cook_time }}m cook{% endif %} {% if recipe.servings %}{{ recipe.servings }} serv{% endif %} {% if recipe.cuisine %}{{ recipe.cuisine }}{% endif %}
{% for rt in recipe.recipe_tags[:3] %} {{ rt.tag.name }} {% endfor %}
{% endfor %}
{% else %} {# DEFAULT: horizontal #}
{% for recipe in recipes %}
{% if recipe.image_filename %} {% else %}
{% endif %}
{{ recipe.title }}
{% if recipe.description %}

{{ recipe.description }}

{% endif %}
{% if recipe.prep_time %}{{ recipe.prep_time }}m prep{% endif %} {% if recipe.cook_time %}{{ recipe.cook_time }}m cook{% endif %} {% if recipe.servings %}{{ recipe.servings }} serv{% endif %} {% if recipe.cuisine %}{{ recipe.cuisine }}{% endif %}
{% for rt in recipe.recipe_tags[:3] %} {{ rt.tag.name }} {% endfor %}
{% endfor %}
{% endif %} {% if total_pages > 1 %}
{% set args = request.args.to_dict() %} {% if page > 1 %} {% set _ = args.update({'page': page - 1}) %} {% else %} {% endif %} {% for p in range(1, total_pages + 1) %} {% if p == page %} {% elif p == 1 or p == total_pages or (p >= page - 2 and p <= page + 2) %} {% set _ = args.update({'page': p}) %} {{ p }} {% elif p == page - 3 or p == page + 3 %} {% endif %} {% endfor %} {% if page < total_pages %} {% set _ = args.update({'page': page + 1}) %} {% else %} {% endif %}
{% endif %}
{% endblock %}