Skip to content

Commit

Permalink
merge conflicts resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
jonager committed Aug 31, 2017
2 parents 1d3351f + 836bc5d commit 92da07c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 43 deletions.
34 changes: 1 addition & 33 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from app import app, db
from flask import request, redirect, render_template, session, flash
from models import Student, Teacher, Attendance
<<<<<<< HEAD
from datetime import datetime, date
from app import app, db
from models import Student, Teacher, Attendance
Expand All @@ -12,31 +13,13 @@
# def index():
# return render_template('index.html')

<<<<<<< HEAD
session['username'] = username
=======

# # Teacher Login
# @app.route('/teacher_login', methods=["POST", "GET"])
# def login():
# return render_template('/teacher_login.html')

>>>>>>> a191cc6c6209c8fb615bfcaefc6a2e23eb11753f

# # Teacher Signup
# @app.route('/teacher_signup', methods=["POST", "GET"])
# def login():
# return render_template('/teacher_login.html')


# # Logout
# @app.route('/logout')
# def logout():
# del session['email']
# return redirect('/')


<<<<<<< HEAD
# Student Login
@app.route('/student_login', methods=["POST", "GET"])
def student_login():
Expand All @@ -58,12 +41,6 @@ def student_login():
else:
students = Student.query.order_by(Student.last_name).all()
return render_template('student_login.html', title = 'Student Login', students = students)
=======
# # Student Login
# @app.route('/student_login', methods=["POST", "GET"])
# def student_login():
# return render_template('student_login.html')
>>>>>>> a191cc6c6209c8fb615bfcaefc6a2e23eb11753f


# # Attendance List
Expand All @@ -77,16 +54,7 @@ def student_login():
# def student_list():
# return render_template('student_list.html')

@app.before_request
def require_login():
blocked_routes = ['index', 'student_login', 'edit_student', 'attendance', 'add_student', 'students']
allowed_routes = ['teacher_login']
if request.endpoint not in allowed_routes and 'username' not in session:
return redirect('/teacher_login')

@app.route("/")
def index():
return render_template("index.html")


@app.route("/teacher_login", methods=['GET', 'POST'])
Expand Down
38 changes: 28 additions & 10 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel='stylesheet' type="text/css" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel='stylesheet' type="text/css" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" media="screen,projection">
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/style.css') }}" media="screen,projection">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<script type="text/javascript" src="{{ url_for('static',filename='js/plugins.js') }}"></script>
<title>LaunchCode Attendance</title>
<title>{{ title }}</title>
<style>
body {
display: flex;
Expand All @@ -32,13 +33,24 @@
.indicator{
background-color: rgba(000,188,212,1) !important;
}
nav .brand-logo{
font-size: 1.75rem;
}
.dropdown-content li>a, .dropdown-content li>span{
color: whitesmoke;
}
.dropdown-content{
min-width: 165px;
}
</style>
<script>
$(document).ready(function(){
// Initialize collapsibles
$(".collapsible").collapsible();
// Initialize collapse button
$(".button-collapse").sideNav();
// Initialize dropdown
$(".dropdown-button").dropdown();
});
</script>
</head>
Expand All @@ -47,16 +59,22 @@
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper cyan">
<a href="/" class="brand-logo center">LaunchCode Attendance</a>
{% if session['email'] %}
<ul class="left">
<li><a class="dropdown-button" href="#!" data-activates="dropdown"><i class="material-icons">menu</i></a></li>
</ul>
<a href="#" data-activates="mobile-demo" class="button"></a>
<ul class="dropdown-content amber darken-2" id="dropdown">
<li><a href="/" class="waves-effect waves-light"><i class="material-icons left">home</i>Home</a></li>
<li><a href="/attendance" class="waves-effect waves-light"><i class="material-icons left">perm_contact_calendar</i>Attendance</a></li>
<li><a href="/students" class="waves-effect waves-light"><i class="material-icons left">people</i>Students</a></li>
</ul>
<ul class="right">
{% if session['username'] %}
<li>{{ session['username'].title() }}</li>
<li><a href="/students">Students</a></li>
<li><a href="/attendance">Attendance</a></li>
<li><a href="/logout">Logout</a></li>
{% else %}
<li><a href="/teacher_login">Login</a></li>
{% endif %}
<li><a class="right waves-effect waves-light waves-light" href="/logout">Logout</a></li>
</ul>
{% else %}
{% endif %}
</div>
</nav>
</div>
Expand Down
33 changes: 33 additions & 0 deletions templates/student_login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'base.html' %}
{% block content %}
<div class="card small">
<div class="card-content">
{% if students|length == 0 %}
<span class="card-title" >No Students Yet, <a href="/students">Add some students</a>!</span>
{% else %}
<span class="card-title" >Students Login</span>
<form action="/student_login" method="post">
<div class="row">
<div class="input-field col s12">
<select id="options">
<option value="" disabled selected>Select your name</option>
{% for student in students %}
<option value="{{student.id}}">{{ student.last_name}}, {{ student.first_name }}</option>
{% endfor %}
</select>
<label for="options">Students</label>
</div>
<div class="row"></div>
<div class="row">
<div class="input-field col s6 center">
<label for="pin">Pin</label>
<input class="validate" id="pin" name="pin" type="password">
<span class="error">{{ pin_err }}</span>
</div>
</div>
</div>
</form>
{% endif %}
</div>
</div>
{% endblock %}

0 comments on commit 92da07c

Please sign in to comment.