Add phase 3: comments and cooking mode

- Comments on visible recipes; author and admin may delete; per-user
  hourly rate limit (COMMENT_RATE_LIMIT_PER_HOUR)
- Cooking mode with large text, tick-off checklists, serving scaling and
  Screen Wake Lock to keep the display on
- Serving calculator auto-submits on change
- Privacy tests cover comment and cooking-mode URLs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Kyle Dammann
2026-10-30 21:39:15 +01:00
co-authored by Claude Opus 5.5
parent 6f7e4f92ca
commit 9256e94286
14 changed files with 342 additions and 16 deletions
+35
View File
@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}Kochmodus: {{ recipe.title }}{% endblock %}
{% block content %}
<div class="cook" data-wakelock>
<div class="page-head">
<h1>{{ recipe.title }}</h1>
<a class="button secondary" href="{% url 'recipes:detail' recipe.pk %}">Fertig</a>
</div>
<p class="muted wakelock-status" hidden>Bildschirm bleibt an.</p>
<section class="card">
<div class="section-head">
<h2>Zutaten</h2>
{% include "recipes/_servings.html" %}
</div>
{% for group, items in ingredient_groups %}
{% if group %}<h3>{{ group }}</h3>{% endif %}
<ul class="checklist">
{% for ing in items %}
<li><label><input type="checkbox"> <span><strong>{{ ing.amount }} {{ ing.unit }}</strong> {{ ing.name }}{% if ing.note %}, {{ ing.note }}{% endif %}</span></label></li>
{% endfor %}
</ul>
{% endfor %}
</section>
<section class="card">
<h2>Zubereitung</h2>
<ol class="checklist steps-big">
{% for step in steps %}
<li><label><input type="checkbox"> <span><span class="step-no">{{ forloop.counter }}.</span> {{ step.text|linebreaksbr }}</span></label></li>
{% endfor %}
</ol>
</section>
</div>
{% endblock %}
+25 -2
View File
@@ -22,7 +22,7 @@
<input type="hidden" name="next" value="{{ request.get_full_path }}">
<button type="submit" class="button secondary">{% if is_favorite %}★ Favorit{% else %}☆ Merken{% endif %}</button>
</form>
{% block extra_actions %}{% endblock %}
<a class="button secondary" href="{% url 'recipes:cook' recipe.pk %}{% if servings != recipe.servings %}?portionen={{ servings }}{% endif %}">Kochmodus</a>
{% if is_owner %}<a class="button secondary" href="{% url 'recipes:edit' recipe.pk %}">Bearbeiten</a>{% endif %}
{% if can_delete %}<a class="button danger" href="{% url 'recipes:delete' recipe.pk %}">Löschen</a>{% endif %}
</div>
@@ -80,6 +80,29 @@
<p class="muted">Quelle: <a href="{{ recipe.source_url }}" rel="noopener noreferrer nofollow" target="_blank">{{ recipe.source_url|truncatechars:60 }}</a></p>
{% endif %}
{% block after_recipe %}{% endblock %}
<section class="card" id="kommentare">
<h2>Kommentare{% if comments %} ({{ comments|length }}){% endif %}</h2>
{% for comment in comments %}
<div class="comment" id="kommentar-{{ comment.pk }}">
<div class="comment-head">
<strong>{{ comment.author.display_name }}</strong>
<span class="muted">{{ comment.created_at|date:"d.m.Y H:i" }}</span>
</div>
<p>{{ comment.text|linebreaksbr }}</p>
{% if comment.pk in deletable_comments %}
<form method="post" action="{% url 'recipes:comment_delete' recipe.pk comment.pk %}">
{% csrf_token %}<button type="submit" class="linklike small-link">Löschen</button>
</form>
{% endif %}
</div>
{% empty %}
<p class="muted">Noch keine Kommentare.</p>
{% endfor %}
<form method="post" action="{% url 'recipes:comment_create' recipe.pk %}" class="comment-form" novalidate>
{% csrf_token %}
{% with form=comment_form %}{% include "form_fields.html" %}{% endwith %}
<button type="submit" class="button">Kommentieren</button>
</form>
</section>
</article>
{% endblock %}