Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 633fde2

Browse files
rico-hengstkuro610
authored andcommitted
Update dish editor to BS5 fixes #130
1 parent 5a2ec46 commit 633fde2

File tree

4 files changed

+97
-57
lines changed

4 files changed

+97
-57
lines changed

root/static/css/local_bootstrap_modifications.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ BOOSTRAP LOCAL CUSTOMIZATION
99
}
1010

1111

12+
.mt-n3 {
13+
margin-top: -1rem !important;
14+
}
15+
16+
textarea {
17+
resize: vertical;
18+
}
19+
1220

1321
/*
1422
redefined list -> non-indended

root/static/css/style.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ main a {
7979
main a:hover,
8080
main a:focus {
8181
color: var(--bs-dark);
82+
text-decoration: underline;
8283
}
8384

8485
a.btn-secondary {
@@ -141,10 +142,6 @@ table td input[type="checkbox"]:first-child:last-child {
141142

142143
table td.right-align { text-align: right }
143144

144-
select:hover, select:active {
145-
box-shadow: 2px 2px 3px grey;
146-
}
147-
148145
fieldset{
149146
border: 1px solid #333333;
150147
}

root/templates/dish/edit.tt

Lines changed: 87 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,103 @@
11
[% escape_title( 'Dish', dish.name ) %]
22

3-
<p>for meal <em>[% dish.meal.name | html %]</em> on [% display_date(dish.meal.date, {html=>1}) %]</p>
4-
5-
[% IF dish.recipe %]
6-
<p>from recipe <a href="[% dish.recipe.url %]">[% dish.recipe.name | html %]</a></p>
7-
[% END %]
8-
9-
<form method="post" action="[% delete_url %]">
10-
<input type="submit" value="Delete dish">
11-
</form>
12-
13-
<form action="[% dish.update_url %]" method="post">
14-
<p>Name: <input type="text" name="name" value="[% dish.name | html %]"></p>
15-
<p>Comment: <input type="text" name="comment" value="[% dish.comment %]"></p>
16-
<p>Servings: <input type="number" name="servings" value="[% dish.servings %]"> <em>Changing here doesn’t recalculate values!</em></p>
17-
<p>Tags: <input type="text" name="tags" value="[% dish.tags_joined %]"></p>
18-
<p><label for="prepare_at_meal">Prepare at meal:</label>
19-
<select id="prepare_at_meal" name="prepare_at_meal">
20-
<option value="" [% 'selected' IF NOT dish.prepare_at_meal.defined %]>(none)</option>
21-
[% FOR meal IN prepare_meals %]
22-
<option value="[% meal.id %]" [% 'selected' IF dish.prepare_at_meal.id == meal.id %]>[% display_date(meal.date) %]: [% meal.name | html %]</option>
23-
[% END %]
24-
</select>
25-
</p>
26-
27-
<h3>Preparation</h3>
28-
<div class="row mb-2">
29-
<div class="col-sm-6 mb-sm-0 mb-2">
30-
<textarea class="form-control with-markdown-preview" name="preparation" rows="10">[% dish.preparation | html %]</textarea>
31-
</div>
3+
<div class="row mb-3 mt-n3">
4+
<div class="col-sm-6">
5+
<p class="m-0">for meal <em>[% dish.meal.name | html %]</em> on [% display_date(dish.meal.date, {html=>1}) %]</p>
6+
[% IF dish.recipe %]
7+
<p class="m-0">from recipe <a href="[% dish.recipe.url %]">[% dish.recipe.name | html %]</a></p>
8+
[% END %]
9+
</div>
10+
11+
<form class="col-sm-3 offset-sm-3 col-lg-2 offset-lg-4 mt-3 mt-sm-0 btn-group" method="post" action="[% delete_url %]">
12+
<button type="button" class="btn btn-danger" title="Delete dish" aria-expanded="false">
13+
<i class="material-icons">delete_forever</i> Delete
14+
</button>
15+
</form>
3216
</div>
3317

18+
<form action="[% dish.update_url %]" method="post">
3419

35-
<h3>Description</h3>
36-
<div class="row mb-2">
37-
<div class="col-sm-6 mb-sm-0 mb-2">
38-
<textarea class="form-control with-markdown-preview" name="description" rows="10">[% dish.description | html %]</textarea>
20+
<div class="card">
21+
<div class="card-header">
22+
<h3 id="section_general_information"><a name="add ingredients">General information</a></h3>
23+
</div>
24+
<div class="card-body">
25+
<div class="mb-3">
26+
<label for="name" class="form-label">Name</label>
27+
<input id="name" class="form-control" type="text" name="name" value="[% dish.name | html %]">
28+
</div>
29+
<div class="mb-3">
30+
<label for="comment" class="form-label">Comment</label>
31+
<textarea id="comment" class="form-control" name="comment">[% dish.comment %]</textarea>
32+
</div>
33+
<div class="mb-3">
34+
<label for="tags" class="form-label">Tags</label>
35+
<input id="tags" class="form-control" type="text" name="tags" value="[% dish.tags_joined %]">
36+
</div>
37+
<div class="row mb-3">
38+
<div class="col-md">
39+
<label for="servings" class="form-label">Servings</label>
40+
<input id="servings" class="form-control" type="number" name="servings" value="[% dish.servings %]" readonly>
41+
<small class="text-muted">For a recalculation see <a href="#section_recalculate_values">form</a> below.</small>
42+
</div>
43+
<div class="col-md mt-3 mt-md-0">
44+
<label for="prepare_at_meal" class="form-label">Prepare at meal</label>
45+
<select id="prepare_at_meal" class="form-control" name="prepare_at_meal">
46+
<option value="" [% 'selected' IF NOT dish.prepare_at_meal.defined %] >(none)</option>
47+
[% FOR meal IN prepare_meals %]
48+
<option value="[% meal.id %]" [% 'selected' IF dish.prepare_at_meal.id == meal.id %]>[% display_date(meal.date) %]: [% meal.name | html %]</option>
49+
[% END %]
50+
</select>
51+
</div>
52+
</div>
53+
<div class="mb-3">
54+
<label for="preparation" class="form-label">Preparation</label>
55+
<div class="row">
56+
<div class="col-md-6 mb-md-0 mb-2">
57+
<textarea id="preparation" class="form-control with-markdown-preview" name="preparation" rows="10">[% dish.preparation | html %]</textarea>
58+
</div>
59+
</div>
60+
</div>
61+
<div class="mb-3">
62+
<label for="description" class="form-label">Description</label>
63+
<div class="row">
64+
<div class="col-md-6 mb-md-0 mb-2">
65+
<textarea id="description" class="form-control with-markdown-preview" name="description" rows="10">[% dish.description | html %]</textarea>
66+
</div>
67+
</div>
68+
</div>
69+
<div class="text-end">
70+
<button type="submit" class="btn btn-primary">Update dish</button>
71+
</div>
3972
</div>
4073
</div>
41-
42-
<p><input type="submit" value="Update Dish"></p>
43-
44-
<h2><a name="ingredients">Ingredients</a></h2>
45-
74+
4675
[% INCLUDE 'includes/forms/ingredients_editor.tt' %]
4776

48-
<input type="submit" value="Update Dish">
4977
</form>
5078

5179
[% INCLUDE 'includes/forms/ingredients_add.tt' %]
5280

53-
<form method="post" action="[% dish.recalculate_url %]">
54-
<div class="card">
55-
<div class="card-header"><h3>Recalculate values</h3></div>
56-
57-
<div class="card-body">
58-
<p>Adjust the values in the table above by <strong>changing the number of servings</strong>
59-
(currently [% dish.servings %])
60-
and <strong>automatically de-/increasing the numbers</strong> in the same ratio.</p>
6181

6282

63-
<label for="recalculate_servings">Servings:</label>
64-
<input id="recalculate_servings" type="number" name="servings" value="[% dish.servings %]">
65-
<input type="submit" value="Recalculate values">
66-
</div>
67-
</div>
83+
<form class="mt-3" method="post" action="[% dish.recalculate_url %]">
84+
<div class="card">
85+
<div class="card-header">
86+
<h3 id="section_recalculate_values">Recalculate values</h3>
87+
</div>
88+
<div class="card-body">
89+
<p>Adjust the values in the <a href="#ingredients">table above</a> above by changing the number of servings</strong>
90+
(currently [% dish.servings %])
91+
and <strong>automatically de-/increasing the numbers</strong> in the same ratio.</p>
92+
<div class="row align-items-center">
93+
<label for="value" class="col-sm-3 col-form-label">Servings</label>
94+
<div class="col-sm-5">
95+
<input id="recalculate_servings" type="number" name="servings" value="[% dish.servings %]" class="form-control">
96+
</div>
97+
<div class="col-sm-4 mt-3 mt-sm-0 text-end">
98+
<button type="submit" class="btn btn-primary">Recalculate values</button>
99+
</div>
100+
</div>
101+
</div>
102+
</div>
68103
</form>

root/templates/includes/forms/ingredients_editor.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="col-sm-12 py-3">
33
<div class="card">
44
<div class="card-header">
5-
<h3><a name="ingredients">Ingredients</a></h3>
5+
<h3 id="ingredients"><a name="ingredients">Ingredients</a></h3>
66
</div>
77
<div class="card-body">
88

0 commit comments

Comments
 (0)