-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (105 loc) · 3.57 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<!-- EXTEND (base.html), homesite/base.html is template for all rendered pages in the project -->
{% extends "base.html" %}
<!-- STYLE (in <head>), style enhancements for page -->
{% block style %}
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
{% endblock %}
<!-- SCRIPT (in <head>), script enhancements for page -->
{% block script %}
<script>
<!-- Password verification and error message -->
function verifyPassword() {
const psw = document.getElementById("password").value;
if (psw.length < 6 || psw.length > 20) {
document.getElementById("pswError").innerHTML = "Password must be between 6 and 20 characters";
return false;
}
}
</script>
{% endblock %}
<!-- CONTENT (in <body>), content for this page -->
{% block content %}
<!-- Sample table rendering and filtering link -->
<div class="jumbotron jumbotron-fluid" style="height: 50%; ">
<!-- title -->
<div class="row justify-content-center">
<div class="col-10" style="text-align: center;">
<h1>Sample Table</h1>
</div>
</div>
<!-- backend filtering actions -->
<div class="row courses-buttons justify-content-center">
<table id="links">
<tr>
<td><a href={{url_for('.databases')}}>Full Table </a></td>
<td><a href={{url_for('.emails')}}>E-Mails only</a></td>
</tr>
</table>
</div>
<!-- Table display, "table" variable and rows with "dictionary elements" are expected -->
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Password</th>
<th>Emails</th>
</tr>
<!-- Loop through rows in table -->
<p>grace was here</p>
{% for row in table %}
<!--
Prepare table for display
-->
<tr>
<th>{{ row['id'] }}</th>
<th>{{ row['name'] }}</th>
<th>{{ row['password'] }}</th>
<th>{{ row['emails'] }}</th>
</tr>
{% endfor %}
</table>
</div>
<!-- Create action, input and "Add" a new row to table -->
<div class="jumbotron jumbotron-fluid" style="height: 50%; ">
<div class="row justify-content-center">
<div class="col-10" style="text-align: center;">
<h1>CRUD: Create</h1>
</div>
</div>
<div class="row courses-buttons justify-content-center">
<form method="POST" ID="create" onsubmit ="return verifyPassword()" action={{url_for('.create')}} >
<table>
<tr>
<th><label for="name">Name</label></th>
<th><label for="password">Password</label></th>
<th><label for="email">Email</label></th>
</tr>
<tr>
<th><input type="text" name="name" id="name" required></th>
<th><input type="password" name="password" id="password" required></th>
<th><input type="email" name="email" placeholder="abc@xyz.org"></th>
<th><input type="submit" value="Add"></th>
</tr>
</table>
<p id="pswError"></p>
</form>
</div>
</div>
</div>
{% endblock %}