summaryrefslogtreecommitdiff
path: root/layouts/recipes/single.html
blob: 79199709d55a4d90592122549250db3b59349519 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{{ 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 }}
		{{- if .Draft }}
		<section class="admonition">
			<div class="admonition-title">
				draft
			</div>
			<div class="admonition-content">
				This recipe is still a <strong>draft</strong>.
				It has most likely been shared with you for
				reviewing purposes, but neither the
				instructions nor the ingredients have been
				properly checked yet. Do not make this recipe
				unless you are an experienced cook, and please
				do not yet share it with other people.
			</div>
		</section>
		{{- 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>
						{{- if .links }}
						{{- range .links }}
						<a class="external-link-icon" href="{{ . }}"></span></a>
						{{- end }}
						{{- end }}
					</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 }}