Skip to content

Commit 3878a81

Browse files
committed
Homepage and todos template
1 parent 692bd0b commit 3878a81

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

ch04/todos/templates/home.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Packt Todo Application</title>
8+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
9+
integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
10+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css"
11+
integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
12+
</head>
13+
<body>
14+
<header>
15+
<nav class="navar">
16+
<div class="container-fluid">
17+
<center>
18+
<h1>Packt Todo Application</h1>
19+
</center>
20+
</div>
21+
</nav>
22+
</header>
23+
<div class="container-fluid">
24+
{% block todo_container %}{% endblock %}
25+
</div>
26+
</body>
27+
</html>

ch04/todos/templates/todo.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{% extends "home.html" %}
2+
3+
{% block todo_container %}
4+
<main class="container">
5+
<hr>
6+
7+
<section class="container-fluid">
8+
<form method="post">
9+
<div class="col-auto">
10+
<div class="input-group mb-3">
11+
<input type="text" name="item" value="{{ item }}" class="form-control"
12+
placeholder="Purchase Packt's Python workshop course" aria-label="Add a todo"
13+
aria-describedby="button-addon2"/>
14+
<button class="btn btn-outline-primary" type="submit" id="button-addon2"
15+
data-mdb-ripple-color="dark">
16+
Add Todo
17+
</button>
18+
</div>
19+
</div>
20+
</form>
21+
</section>
22+
23+
24+
{% if todo %}
25+
<article class="card container-fluid">
26+
<br/>
27+
<h4>Todo ID: {{ todo.id }} </h4>
28+
<p>
29+
<strong>
30+
Item: {{ todo.item }}
31+
</strong>
32+
</p>
33+
</article>
34+
{% else %}
35+
<section class="container-fluid">
36+
<h2 align="center">Todos</h2>
37+
<br>
38+
<div class="card">
39+
<ul class="list-group list-group-flush">
40+
{% for todo in todos %}
41+
<li class="list-group-item">
42+
{{ loop.index }}. <a href="/todo/{{ loop.index }}"> {{ todo.item }} </a>
43+
</li>
44+
{% endfor %}
45+
</ul>
46+
</div>
47+
{% endif %}
48+
</section>
49+
</main>
50+
{% endblock %}

0 commit comments

Comments
 (0)