summaryrefslogtreecommitdiff
path: root/layouts/recipes/single.html
blob: 01b0bd2e6a1f584e7edeb5ed0120744cd3f9307c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{{ define "head" }}
<script type="text/javascript" src="/js/cookbook.js"></script>
{{ end }}

{{ define "main" }}
<article>
	<header>
		<h1>{{ .Title }}</h1>
		{{- range .Params.tags }}
			<a href="/tags/{{ . | lower }}">#{{ . }}</a>
		{{- end }}
	</header>
	<main>
		{{ .Content }}
		<table>
			<tbody>
				<tr>
					<td>Preparation time</td>
					<td>{{ .Params.preptime }} minutes</td>
				</tr>
				<tr>
					<td>Cooking time</td>
					<td>{{ .Params.cooktime }} minutes</td>
				</tr>
				<tr>
					<td>Serves</td>
					<td data-serves="{{ .Params.serves }}">{{ .Params.serves }}</td>
				</tr>
			</tbody>
		</table>
		<h2>Ingredients</h2>
		<table>
			<thead>
				<tr>
					<th>&nbsp;</th>
					<th>Ingredient</th>
					<th>Amount</th>
					<th>Unit</th>
				</tr>
			</thead>
			<tbody>
			{{- range $i, $ingredient := .Params.ingredients }}
				<tr>
					<td>
						<input id="ingredient{{ $i }}" type="checkbox">
					</td>
					<td><label for="ingredient{{ $i }}">{{ .label }}</label></td>
					{{- if .unit }}
					<td data-unit="{{ $ingredient.unit }}" data-amount="{{ $ingredient.amount }}">{{ .amount }}</td>
					<td data-unit="{{ $ingredient.unit }}">{{ $ingredient.unit }}</td>
					{{- else }}
					<td colspan="2">{{ $ingredient.amount }}</td>
					{{- end }}
				</tr>
			{{- end }}
			</tbody>
		</table>
		<h2>Instructions</h2>
		{{- range $i, $stage := .Params.stages }}
			<h3>{{ $stage.label }}</h3>
			<ol>
			{{- range $j, $step := $stage.steps }}
				<li>
					<input id="stage{{ $i }}-step{{ $j }}" type="checkbox">
					<label for="stage{{ $i }}-step{{ $j }}">{{ $step | $.Page.RenderString }}</label>
				</li>
			{{- end }}
			</ol>
		{{- end }}
	</main>
	<footer>
		<p class="text-center">
			<a class="image-link" rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
				<img alt="Creative Commons License" src="/img/cc-by-sa.png">
			</a>
		</p>
	</footer>
</article>
{{ end }}