TandoorRecipes/cookbook/templates/recipe_view.html
2019-11-14 18:28:50 +01:00

70 lines
2.0 KiB
HTML

{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load custom_tags %}
{% block title %}{% trans 'View' %}{% endblock %}
{% block content %}
<h3>{{ recipe.name }} <a href="{% url 'edit_recipe' recipe.pk %}"><i class="fas fa-pencil-alt"></i></a></h3>
{% if ingredients %}
<small>{% trans 'by' %} {{ recipe.created_by.username }}</small><br/><br/>
{% else %}
<small>{% trans 'in' %} <a
href="{% url 'edit_storage' recipe.storage.pk %}">{{ recipe.storage.name }}</a></small><br/><br/>
{% endif %}
{% if recipe.all_tags %}
{{ recipe.all_tags }}
<br/>
{% endif %}
<br/>
{% if ingredients %}
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">{% trans 'Ingredients' %}</h5>
{% for i in ingredients %}
{{ i.amount }} {{ i.unit }} {{ i.ingredient.name }} <br/>
{% endfor %}
</div>
</div>
<br/>
<br/>
{{ recipe.instructions | markdown | safe }}
{% else %}
{% trans 'This is an external recipe.' %}
<a href='#' onClick='openRecipe({{ recipe.id }})'>{% trans 'Open recipe' %} <i
class="fas fa-external-link-alt"></i></a>
{% endif %}
<br/>
<br/>
<h5>{% trans 'Comments' %}</h5>
<form method="POST" class="post-form">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="{% trans 'Comment' %}" class="btn btn-success">
</form>
{% for c in comments %}
<div class="card">
<div class="card-body">
<small class="card-title">{{ c.updated_at }} {% trans 'by' %} {{ c.created_by.username }}</small> <br/>
{{ c.text }}
</div>
<br/>
</div>
{% endfor %}
{% if not ingredients %}
{% include 'include/recipe_open_modal.html' %}
{% endif %}
{% endblock %}