Skip to content
Snippets Groups Projects
Commit e37972df authored by mrschnei's avatar mrschnei
Browse files

Updated the Tutor page and changed tutor sign ups

parent 4f7f8339
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
You have already signed up for tutoring
</p>
<form action="/accounts/duplicateTutor/" method="post" enctype="multipart/form-data">
<input type="submit" name="return" value="Return to Home" />
<input type="submit" name="return" value="Return to Tutoring Page" />
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box;}
/* Full-width input fields */
input[type=text] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
border: none;
background: #f1f1f1;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: #474e5d;
padding-top: 50px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
}
/* The Close Button (x) */
.close {
position: absolute;
right: 35px;
top: 15px;
font-size: 40px;
font-weight: bold;
color: #f1f1f1;
}
/* Add padding to container elements */
.container {
padding: 16px;
}
.close:hover,
.close:focus {
color: #f44336;
cursor: pointer;
}
.su {
float: right;
}
/* Clear floats */
.clearfix::after {
content: "";
clear: both;
display: table;
}
</style>
<body>
<a href="/">Home</a>
<title>ServicePoints</title>
<form action="/accounts/tutorsu/" method="post" enctype="multipart/form-data">
<p>
Full Name
<input type="text" name="username" />
</p>
<p>
Tutuoring Subject(s):
<input type="text" name="subjects" />
</p>
<p>
Available times
<input type="text" name="time" />
</p>
<input type="submit" name="signup" value="sign up" />
</form>
<div class="su">
<button onclick="document.getElementById('id01').style.display='block'" style="width:auto; right: 35px">Sign Up</button>
</div>
<div id="id01" class="modal">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">&times;</span>
<form class="modal-content" action="/accounts/tutorsu/" method="post">
<div class="container">
<h1>Sign Up</h1>
<p>Please fill in this form to sign up as a tutor.</p>
<hr>
<label for="name"><b>Full Name</b></label>
<input type="text" placeholder="Enter Full Name" name="name" required>
<label for="subjects"><b>Tutoring Subject(s)</b></label>
<input type="text" placeholder="Enter Subject(s)" name="subjects" required>
<label for="time"><b>Available Times</b></label>
<input type="text" placeholder="Enter Times" name="time" required>
<div class="clearfix">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
<button type="submit" class="signup">Sign Up</button>
</div>
</div>
</form>
</div>
<hr>
<h3>Username, Subject, Time, Email</h3>
<p>
{% for tutor, email_ in zip(tutors, emails) %}
<p>{{tutor.username}}, {{tutor.subject}}, {{tutor.time}}, {{email_.email}}</p>
{% endfor %}
</p>
</body>
</html>
......@@ -237,7 +237,7 @@ def duplicateOrgName():
@servicePoints.app.route('/accounts/duplicateTutor/', methods=['GET', 'POST'])
def duplicateTutor():
if flask.request.method == 'POST':
return flask.redirect(flask.url_for('tutor'))
return flask.redirect(flask.url_for('tutorsu'))
context = {}
return render_template('duplicateTutor.html', **context)
......@@ -288,8 +288,20 @@ def tutorsu():
return flask.redirect(flask.url_for('index'))
context = {}
return render_template('tutor.html', **context)
cursor = servicePoints.model.get_db()
cur = cursor.execute("SELECT * FROM tutors")
tutors = cur.fetchall()
username = flask.session["username"]
cur2 = cursor.execute('SELECT email FROM users WHERE '
'username =:who',
{"who": username})
emails = cur2.fetchall()
# Add database info to context
context = {"tutors": tutors, "emails": emails}
return flask.render_template("tutor.html", **context,zip=zip)
@servicePoints.app.route('/accounts/submitPoints/', methods=['GET', 'POST'])
def submitPoints():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment