Improved delete, scaling added
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
@@ -26,4 +27,7 @@
|
||||
© Copyright 2022 by <a href="https://github.com/ljensen505">Lucas Jensen</a>.
|
||||
{% endblock %}
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
@@ -7,23 +7,44 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>New Recipe</h1>
|
||||
<h1>New Recipe</h1>
|
||||
|
||||
<form action="{{ url_for("add_recipe")}}" method="post">
|
||||
|
||||
<label for="name">Recipe Name:</label><br>
|
||||
<input required type="text" id="name" name="name" placeholder="Sourdough">
|
||||
<br>
|
||||
<p>Enter all values grams.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Recipe Name:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input required type="text" id="name" name="name" placeholder="Sourdough">
|
||||
</td>
|
||||
</tr>
|
||||
<td>
|
||||
<label for="yield">Loaves:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input required type="number" id="yield" name="yield" placeholder="2">
|
||||
</td>
|
||||
</table>
|
||||
|
||||
{% for ing in ['flour', 'water', 'salt'] %}
|
||||
<label for="{{ing}}_weight">{{ing.title()}}:</label><br>
|
||||
<input required type="number" id="{{ing}}_weight" name="{{ing}}_weight" placeholder="100"><br>
|
||||
<br>
|
||||
{% endfor %}
|
||||
<p>Enter all values grams. If an ingredient is not needed, input 0.</p>
|
||||
|
||||
<label for="yield">Loaves:</label><br>
|
||||
<input required type="number" id="yield" name="yield" placeholder="2">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Ingredient</th>
|
||||
<th>Mass in g</th>
|
||||
</tr>
|
||||
|
||||
{% for item in ['AP Flour', 'WW Flour', 'Rye Flour', 'Water', 'Salt', 'Yeast', 'Starter'] %}
|
||||
|
||||
<tr>
|
||||
<td><label for="{{item}}_weight">{{item}}:</label></td>
|
||||
<td><input required type="number" id="{{item}}_weight" name="{{item}}" placeholder="500"></td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<button type="submit">Add!</button>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{content["name"]}}{% endblock %}
|
||||
{% block title %}{{content.get_name()}}{% endblock %}
|
||||
|
||||
{% block html_head %}
|
||||
|
||||
@@ -7,24 +7,31 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{content["name"]}} Recipe</h1>
|
||||
<h1>{{ content.get_name() }} Recipe</h1>
|
||||
|
||||
|
||||
<p>Number of loaves: {{content['quantity']}}</p>
|
||||
<p>Number of loaves: {{ content.get_num_loaves() }}</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Ingredient</th>
|
||||
<th>Grams</th>
|
||||
</tr>
|
||||
{% for item in content['ingredients'] %}
|
||||
{% for item in content.get_ingredients() %}
|
||||
<tr>
|
||||
<td>{{ item.title() }}</td>
|
||||
<td>{{ content['ingredients'][item] }}</td>
|
||||
<td>{{ item }}</td>
|
||||
<td>{{ content.get_ingredients()[item] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<h2>Scaling</h2>
|
||||
<form method="post">
|
||||
<label for="scale_btn">How many loaves do you want: </label>
|
||||
<input required name="scale" id="scale_btn" type="number">
|
||||
<button type="submit">Go!</button>
|
||||
</form>
|
||||
|
||||
<input type="button" onclick="location.href='/recipes/{{_id}}/delete'" value=Delete />
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
<ul>
|
||||
{% for recipe in content %}
|
||||
<li>
|
||||
<a href=recipes/{{recipe}}>{{content[recipe]['name']}}</a>
|
||||
<a href=recipes/{{recipe}}>{{content[recipe].get_name()}}</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user