diff options
author | Mike Crute <mcrute@gmail.com> | 2010-12-30 01:08:16 -0500 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-12-30 01:08:16 -0500 |
commit | 3c17bf6bcf8622100da0dda6465f5148627d91d8 (patch) | |
tree | 5d9a2c374cc305bdaee595495c1550fbdc15fb93 | |
parent | 5fd79049673e5cd27dc2de828cf7c6d2560aea1f (diff) | |
download | greenbox-3c17bf6bcf8622100da0dda6465f5148627d91d8.tar.bz2 greenbox-3c17bf6bcf8622100da0dda6465f5148627d91d8.tar.xz greenbox-3c17bf6bcf8622100da0dda6465f5148627d91d8.zip |
Createing template inheritence, adding recipe details model.
-rw-r--r-- | greenbox/templates/base_generic.html | 66 | ||||
-rw-r--r-- | greenbox/templates/recipe/recipe_detail.html | 19 | ||||
-rw-r--r-- | greenbox/templates/recipe/recipe_list.html | 9 |
3 files changed, 93 insertions, 1 deletions
diff --git a/greenbox/templates/base_generic.html b/greenbox/templates/base_generic.html new file mode 100644 index 0000000..29e05b2 --- /dev/null +++ b/greenbox/templates/base_generic.html | |||
@@ -0,0 +1,66 @@ | |||
1 | <html> | ||
2 | <head> | ||
3 | <title>{% block page_title %}Home{% endblock %} :: the Green Box</title> | ||
4 | <style type="text/css" media="screen"> | ||
5 | |||
6 | /* LAYOUT ELEMENTS */ | ||
7 | |||
8 | body { | ||
9 | margin: 0px; | ||
10 | padding: 0px; | ||
11 | font: 12px Verdana, sans-serif; | ||
12 | } | ||
13 | |||
14 | #contents { | ||
15 | margin: 20px; | ||
16 | } | ||
17 | |||
18 | /* HEADLINES */ | ||
19 | |||
20 | h1, h2, h3, h4, h5 { | ||
21 | font-weight: lighter; | ||
22 | font-family: Georgia, Times, 'Times New Roman', serif; | ||
23 | } | ||
24 | |||
25 | h1 { font-size: 4em; } | ||
26 | h2 { font-size: 3em; } | ||
27 | h3 { font-size: 2em; } | ||
28 | |||
29 | h1 { | ||
30 | padding: 20px; | ||
31 | background-color: darkgreen; | ||
32 | color: white; | ||
33 | } | ||
34 | |||
35 | h1 .trivial { | ||
36 | color: green; | ||
37 | } | ||
38 | |||
39 | /* LINKS */ | ||
40 | |||
41 | a { | ||
42 | color: green; | ||
43 | text-decoration: none; | ||
44 | border-bottom: 1px dashed lightgreen; | ||
45 | } | ||
46 | |||
47 | a:hover { | ||
48 | border-bottom: 1px solid green; | ||
49 | } | ||
50 | |||
51 | /* TEXT STYLES */ | ||
52 | |||
53 | #recipe_description { | ||
54 | font-style: italic; | ||
55 | } | ||
56 | </style> | ||
57 | </head> | ||
58 | |||
59 | <body> | ||
60 | <h1><span class="trivial">the</span> Green Box</h1> | ||
61 | <div id="contents"> | ||
62 | <h2>{% block title %}{% endblock %}</h2> | ||
63 | {% block contents %}{% endblock %} | ||
64 | </div> | ||
65 | </body> | ||
66 | </html> | ||
diff --git a/greenbox/templates/recipe/recipe_detail.html b/greenbox/templates/recipe/recipe_detail.html new file mode 100644 index 0000000..8f1fa1b --- /dev/null +++ b/greenbox/templates/recipe/recipe_detail.html | |||
@@ -0,0 +1,19 @@ | |||
1 | {% extends "base_generic.html" %} | ||
2 | {% load ingredientformat %} | ||
3 | |||
4 | {% block page_title %}{{ object.title }}{% endblock %} | ||
5 | {% block title %}{{ object.title }}{% endblock %} | ||
6 | |||
7 | {% block contents %} | ||
8 | <div id="recipe_description">{{ object.description|linebreaks }}</div> | ||
9 | |||
10 | <h3>Ingredients</h3> | ||
11 | <ul> | ||
12 | {% for ingredient in object.recipeingredient_set.all %} | ||
13 | <li>{{ ingredient.quantity|format_ingredient_quantity }} {{ ingredient.units.abbreviation }} {{ ingredient.ingredient.name }}</li> | ||
14 | {% endfor %} | ||
15 | </ul> | ||
16 | |||
17 | <h3>Directions</h3> | ||
18 | {{ object.instructions|linenumbers|linebreaks }} | ||
19 | {% endblock %} | ||
diff --git a/greenbox/templates/recipe/recipe_list.html b/greenbox/templates/recipe/recipe_list.html index 3ceae72..b942284 100644 --- a/greenbox/templates/recipe/recipe_list.html +++ b/greenbox/templates/recipe/recipe_list.html | |||
@@ -1,5 +1,12 @@ | |||
1 | {% extends "base_generic.html" %} | ||
2 | |||
3 | {% block page_title %}Recipe List{% endblock %} | ||
4 | {% block title %}Recipe List{% endblock %} | ||
5 | |||
6 | {% block contents %} | ||
1 | <ul> | 7 | <ul> |
2 | {% for recipe in object_list %} | 8 | {% for recipe in object_list %} |
3 | <li>{{ recipe.title }}</li> | 9 | <li><a href="/recipe/{{ recipe.slug }}">{{ recipe.title }}</a></li> |
4 | {% endfor %} | 10 | {% endfor %} |
5 | </ul> | 11 | </ul> |
12 | {% endblock %} | ||