lots of cleanup and refactoring

This commit is contained in:
vabene1111
2019-11-14 18:28:50 +01:00
parent 2e313f6be4
commit a3da7c2ffd
14 changed files with 154 additions and 109 deletions

View File

@@ -8,26 +8,40 @@
{% 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/>
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">{% trans 'Ingredients' %}</h5>
{% 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 %}
{% for i in ingredients %}
{{ i.amount }} {{ i.unit }} {{ i.ingredient.name }} <br/>
{% endfor %}
</div>
</div>
</div>
<br/>
<br/>
<br/>
<br/>
{{ recipe.instructions | markdown | safe }}
{{ 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/>
@@ -37,11 +51,9 @@
<form method="POST" class="post-form">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-success">
<input type="submit" value="{% trans 'Comment' %}" class="btn btn-success">
</form>
{% for c in comments %}
<div class="card">
<div class="card-body">
@@ -52,4 +64,7 @@
</div>
{% endfor %}
{% if not ingredients %}
{% include 'include/recipe_open_modal.html' %}
{% endif %}
{% endblock %}