Rewrite to Django from scratch. Now it's much more user-friendly.
[cookbook.git] / example / data / template / cookbook / recipe.html
diff --git a/example/data/template/cookbook/recipe.html b/example/data/template/cookbook/recipe.html
new file mode 100644 (file)
index 0000000..eb0f5e4
--- /dev/null
@@ -0,0 +1,58 @@
+{% extends "cookbook/base.html" %}
+
+{% block content %}
+<h1>{{ recipe.name }}</h1>
+
+{% block metadata %}
+<table class="metadata">
+  <tr><td>Author</td><td>{{ recipe.author|default:"unknown" }}</td></tr>
+{% if recipe.source or recipe.url %}
+  <tr><td>Source</td><td><a href="{{ recipe.url }}">{{ recipe.source|default:recipe.url }}</a></td></tr>
+{% endif %}
+{% if recipe.x_yield %}
+  <tr><td>Yield</td><td>{{ recipe.x_yield }}</td></tr>
+{% endif %}
+{% if recipe.tags.all %}
+  <tr><td>Tags</td>
+    <td>
+{% for tag in recipe.tags.all %}
+      <a href="{% url tag tag.id %}">{{ tag }}</a>
+{% endfor %}
+    </td>
+  </tr>
+{% endif %}
+</table>
+{% endblock %}
+
+{% block ingredients %}
+<h2>Ingredients</h2>
+
+{% for ingredient_block in recipe.ingredientblock_set.all %}
+<div class="ingredient_block">
+<h3>{{ ingredient_block.name }}</h3>
+<ul>
+{% for ingredient in ingredient_block.ingredient_set.all %}
+  <li>{{ ingredient }}</li>
+{% endfor %}
+</ul>
+{% if ingredient_block.directions %}
+<h4>Directions</h4>
+
+<div class="directions">
+{{ ingredient_block.directions|safe }}
+</div>
+{% endif %}
+
+</div>
+{% endfor %}
+{% endblock %}
+
+{% block directions %}
+<h2>Directions</h2>
+
+<div class="directions">
+{{ recipe.directions|safe }}
+</div>
+{% endblock %}
+
+{% endblock %}