Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Code/Austen/flask-01/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import Flask, request
from flask import render_template as render

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
groups = ['tortilla', 'meat', 'rice', 'beans', 'cheese', 'sour cream']
group_options = {
'tortilla': {
'choices': ['flour', 'corn', 'wheat', 'spinach']
},
'meat': {
'choices': ['beef', 'chicken', 'pork', 'none']
},
'rice': {
'choices': ['white', 'brown']
},
'beans': {
'choices': ['black', 'pinto']
},
'cheese': {
'choices': ['si', 'no']
},
'sour cream': {
'choices': ['si', 'no']
}

}
if request.method == 'POST':
order = request.form
return render('order.html', order=order)

return render('index.html', groups=groups, group_options=group_options)
63 changes: 63 additions & 0 deletions Code/Austen/flask-01/static/signature.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
:root {
--font: consolas;
--font-color: white;
--bg-color: black;
}

/* minor css reset */
body {
vertical-align: baseline;
border: 0 none;
outline: 0;
padding: 0;
margin: 0;
}
ul>li {
list-style: none;
}

/* page styles */
body {
font-family: var(--font);
}
button {
background-color: darkgrey;
}
section {
display: flex;
justify-content: center;
margin: 1rem;
}
ul {
margin: 1rem;
padding: 2rem;
}
ul>li {
margin-right: 2rem;
font-size: 20px;
}
b {
font-size: 18px;
}
.black-white {
color: white;
background-color: black;
}
.center {
text-align: center;
}
.border {
border: 2px solid var(--font-color);
}
.container {
min-width: 50%;
text-align: center;
margin: 1rem;
}
.form-section {
margin-top: 1rem;
}
.option {
border-bottom: .5px dashed var(--font-color);
margin: 1rem;
}
13 changes: 13 additions & 0 deletions Code/Austen/flask-01/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Not a Taco</title>
<link rel="stylesheet" href="{{url_for('static', filename='signature.css')}}">
</head>
<body class="black-white">
<div class="">{% block content %} {% endblock %}</div>
</body>
</html>
35 changes: 35 additions & 0 deletions Code/Austen/flask-01/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% extends 'base.html' %} {% block content %}
<header class="center">
<h1>Not a Taco</h1>
<h4>the Burrito Shop</h4>
</header>
<main class="border">
<form class="container" action="" method="post">
<div class="form-section">
<label for="customer">Your Name:
<input type="text" name="customer" required>
</label>
</div>
{% for group in groups %}
<div class="form-section">{{group.title()}}
<br><br>
{% for choice in group_options[group]['choices'] %}
<label for="{{group}}" class="option">{{choice}}
<input type="radio" name="{{group}}" id="{{group}}-radio" value="{{choice}}" {% if loop.index == 1 %} checked {%
endif %}>
</label>
{% endfor %}
</div>
{% endfor %}
<div class="form-section">
<label for="delivery">Delivery Instructions:
<input type="text-area" name="delivery" id="delivery" required>
</label>
</div>
<div class="form-section">
<button type="submit">Order</button>
</div>
</form>
</main>

{% endblock %}
13 changes: 13 additions & 0 deletions Code/Austen/flask-01/templates/order.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'base.html' %} {% block content %}
<h1 class="center">Your Taco Order</h1>

<section>
<ul class="border">
{% for key in order.keys() %}
<li><b>{{key.title()}}</b>: {{order[key]}}</li>
<br>
{% endfor %}
</ul>

</section>
{% endblock %}