blob: 9f875d98dacba3c31fe5fb9a4d01cc0ca9a679f3 (
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
103
104
105
106
107
108
109
110
111
|
<article class="recipe">
<header class="recipe__header">
<toolbar (isEditionMode)="isContentEditable($event)"></toolbar>
<h2 class="recipe__title">
<ng-container
*ngIf="isEditable; then editableTitle; else staticTitle"
></ng-container>
<ng-template #editableTitle>
<input
type="text"
value="{{ recipe.strMeal }}"
name="strMeal"
(input)="updateRecipe($event)"
class="recipe__field"
/>
</ng-template>
<ng-template #staticTitle>{{ recipe.strMeal }}</ng-template>
</h2>
<dl class="meta">
<dt class="meta__term">Category:</dt>
<dd class="meta__description">
<ng-container
*ngIf="isEditable; then editableCategory; else staticCategory"
></ng-container>
<ng-template #staticCategory>
{{ recipe.strCategory }}
</ng-template>
<ng-template #editableCategory>
<input
type="text"
name="strCategory"
value="{{ recipe.strCategory }}"
(input)="updateRecipe($event)"
class="recipe__field"
/>
</ng-template>
</dd>
</dl>
</header>
<div class="recipe__body">
<div class="recipe__preview">
<h3>Preview</h3>
<img
[src]="getPreview()"
alt="{{ recipe.strMeal }} preview"
class="recipe__thumb"
/>
<ng-container *ngIf="isEditable">
<label class="recipe__label btn" for="recipe-thumb">
Upload a new image
<input
type="file"
name="recipe-thumb"
id="recipe-thumb"
accept="image/png, image/jpeg"
class="recipe__field recipe__field--file"
(change)="updatePreview($event)"
/>
</label>
</ng-container>
</div>
<div class="recipe__ingredients">
<h3>Ingredients</h3>
<ul class="ingredients-list">
<li
*ngFor="let ingredient of getIngredients(); index as i"
class="ingredients-list__item"
>
<ng-container
*ngIf="isEditable; then editableIngredients; else staticIngredients"
></ng-container>
<ng-template #staticIngredients>
{{ ingredient }}
</ng-template>
<ng-template #editableIngredients>
<input
type="text"
name="strIngredient{{ i + 1 }}"
value="{{ ingredient }}"
(input)="updateRecipe($event)"
class="recipe__field"
/>
</ng-template>
</li>
</ul>
</div>
<div class="recipe__instructions">
<h3>Instructions</h3>
<ng-container
*ngIf="isEditable; then editableInstructions; else staticInstructions"
></ng-container>
<ng-template #editableInstructions>
<textarea
textareaResize
name="strInstructions"
(input)="updateRecipe($event)"
class="recipe__field recipe__field--textarea"
>{{ recipe.strInstructions }}</textarea
>
</ng-template>
<ng-template #staticInstructions>{{
recipe.strInstructions
}}</ng-template>
</div>
</div>
<footer class="recipe__footer">
<a routerLink="" class="btn">
<span class="btn__icon">← </span>Back to your recipes
</a>
</footer>
</article>
|