MVP done, along with delete button

This commit is contained in:
lucas
2022-04-28 22:15:45 -07:00
parent 3e346cf3eb
commit 479d38464e
7 changed files with 123 additions and 60 deletions

14
templates/empty.html Normal file
View File

@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block title %}Recipes{% endblock %}
{% block html_head %}
{% endblock %}
{% block content %}
<h1>Bread Recipes</h1>
<p>You haven't added any recipes yet!</p>
{% endblock %}

View File

@@ -11,18 +11,18 @@
<form action="{{ url_for("add_recipe")}}" method="post">
<label for="name">Recipe Name:</label>
<label for="name">Recipe Name:</label><br>
<input required type="text" id="name" name="name" placeholder="Sourdough">
<br>
<p>Enter all values grams.</p>
{% for ing in ['flour', 'water', 'salt'] %}
<label for="{{ing}}_weight">{{ing.title()}}:</label>
<input required type="number" id="{{ing}}_weight" name="{{ing}}_weight" placeholder="100">
<label for="{{ing}}_weight">{{ing.title()}}:</label><br>
<input required type="number" id="{{ing}}_weight" name="{{ing}}_weight" placeholder="100"><br>
<br>
{% endfor %}
<label for="yield">Loaves:</label>
<label for="yield">Loaves:</label><br>
<input required type="number" id="yield" name="yield" placeholder="2">
<button type="submit">Add!</button>

View File

@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Recipes{% endblock %}
{% block title %}{{content["name"]}}{% endblock %}
{% block html_head %}
@@ -7,13 +7,25 @@
{% block content %}
<h1>Bread Recipes</h1>
<ul>
{% for recipe in content %}
<li>
<a href=recipes/{{recipe}}>{{content[recipe]['name']}}</a>
</li>
<h1>{{content["name"]}} Recipe</h1>
<p>Number of loaves: {{content['quantity']}}</p>
<table>
<tr>
<th>Ingredient</th>
<th>Grams</th>
</tr>
{% for item in content['ingredients'] %}
<tr>
<td>{{ item.title() }}</td>
<td>{{ content['ingredients'][item] }}</td>
</tr>
{% endfor %}
</ul>
</table>
<input type="button" onclick="location.href='/recipes/{{_id}}/delete'" value=Delete />
{% endblock %}

19
templates/recipes.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% block title %}Recipes{% endblock %}
{% block html_head %}
{% endblock %}
{% block content %}
<h1>Bread Recipes</h1>
<ul>
{% for recipe in content %}
<li>
<a href=recipes/{{recipe}}>{{content[recipe]['name']}}</a>
</li>
{% endfor %}
</ul>
{% endblock %}