Building new test form
Added CRUD for tests
This commit is contained in:
@ -3,6 +3,4 @@ from flask import Blueprint
|
||||
auth = Blueprint(
|
||||
'quiz_auth',
|
||||
__name__,
|
||||
template_folder='templates',
|
||||
static_folder='static'
|
||||
)
|
@ -1,9 +1,11 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField
|
||||
from wtforms.validators import InputRequired, Email, Length
|
||||
from wtforms.validators import InputRequired, Email, Length, Optional
|
||||
|
||||
class StartQuiz(FlaskForm):
|
||||
given_name = StringField('Given Name', validators=[InputRequired(), Length(max=15)])
|
||||
surname = StringField('Surname', validators=[InputRequired(), Length(max=15)])
|
||||
first_name = StringField('First Name(s)', validators=[InputRequired(), Length(max=30)])
|
||||
surname = StringField('Surname', validators=[InputRequired(), Length(max=30)])
|
||||
email = StringField('Email Address', validators=[InputRequired(), Email(message='You must enter a valid email address.'), Length(max=50)])
|
||||
club = StringField('Affiliated Club', validators=[InputRequired(), Length(max=50)])
|
||||
club = StringField('Affiliated Club (Optional)', validators=[Optional(), Length(max=50)])
|
||||
auth_code = StringField('Exam Code', validators=[InputRequired(), Length(min=14, max=14)])
|
||||
user_code = StringField('User Code (Optional)', validators=[Optional(), Length(min=6, max=6)])
|
@ -0,0 +1,190 @@
|
||||
.bg-light {
|
||||
background-color: #EBE3E1!important;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 80px 0;
|
||||
line-height: 1.5;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
.site-footer {
|
||||
background-color: lightgray;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.site-footer p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.quiz-container {
|
||||
max-width: 720px;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.form-quiz-start {
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-heading {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-label-group {
|
||||
position: relative;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-label-group input,
|
||||
.form-label-group label {
|
||||
padding: var(--input-padding-y) var(--input-padding-x);
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
.form-label-group label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-bottom: 0; /* Override default `<label>` margin */
|
||||
line-height: 1.5;
|
||||
color: #495057;
|
||||
cursor: text; /* Match the input under the label */
|
||||
border: 1px solid transparent;
|
||||
border-radius: .25rem;
|
||||
transition: all .1s ease-in-out;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.form-label-group input {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-radius: 0%;
|
||||
border-bottom: 2px solid #585858;
|
||||
}
|
||||
|
||||
.form-label-group input:active, .form-label-group input:focus {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input::-webkit-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input:-ms-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input::-ms-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input::-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input::placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.form-label-group input:not(:placeholder-shown) {
|
||||
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
|
||||
padding-bottom: calc(var(--input-padding-y) / 3);
|
||||
}
|
||||
|
||||
.form-label-group input:not(:placeholder-shown) ~ label {
|
||||
padding-top: calc(var(--input-padding-y) / 3);
|
||||
padding-bottom: calc(var(--input-padding-y) / 3);
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.form-check {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.checkbox input {
|
||||
transform: scale(1.5);
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.signin-forgot-password {
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
.form-submission-button {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-submission-button button, .form-submission-button a {
|
||||
margin: 1rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.form-submission-button button span, .form-submission-button button svg, .form-submission-button a span, .form-submission-button a svg {
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on November 23, 2021 */
|
||||
|
||||
@font-face {
|
||||
font-family: 'opendyslexic3bold';
|
||||
src: url('../fonts/opendyslexic3-bold-webfont.woff2') format('woff2'),
|
||||
url('../fonts/opendyslexic3-bold-webfont.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'opendyslexic3regular';
|
||||
src: url('../fonts/opendyslexic3-regular-webfont.woff2') format('woff2'),
|
||||
url('../fonts/opendyslexic3-regular-webfont.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'opendyslexicmonoregular';
|
||||
src: url('../fonts/opendyslexicmono-regular-webfont.woff2') format('woff2'),
|
||||
url('../fonts/opendyslexicmono-regular-webfont.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
/* Fallback for Edge
|
||||
-------------------------------------------------- */
|
||||
@supports (-ms-ime-align: auto) {
|
||||
.form-label-group label {
|
||||
display: none;
|
||||
}
|
||||
.form-label-group input::-ms-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback for IE
|
||||
-------------------------------------------------- */
|
||||
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
||||
.form-label-group label {
|
||||
display: none;
|
||||
}
|
||||
.form-label-group input:-ms-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
$(document).ready(function() {
|
||||
$("#od-font-test").click(function(){
|
||||
$("body").css("font-family", "opendyslexic3regular")
|
||||
});
|
||||
|
||||
$('.auth-code-input').keyup(function() {
|
||||
var input = $(this).val().split("-").join("").split("—").join(""); // remove hyphens and mdashes
|
||||
if (input.length > 0) {
|
||||
input = input.match(new RegExp('.{1,4}', 'g')).join("—");
|
||||
}
|
||||
$(this).val(input);
|
||||
});
|
||||
});
|
@ -1,43 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
|
||||
crossorigin="anonymous">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/fontawesome.min.css"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<title>{% block title %} Site Title {% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar fixed-top navbar-expand-md navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a href="/" class="navbar-brand mb-0 h1">SKA Refereeing Test </a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- JQuery, Popper, and Bootstrap js dependencies -->
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
|
||||
integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<!-- Custom js -->
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ url_for('.static', filename='js/script.js') }}"
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
59
ref-test/quiz/templates/quiz/components/base.html
Normal file
59
ref-test/quiz/templates/quiz/components/base.html
Normal file
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
|
||||
crossorigin="anonymous">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.1/font/bootstrap-icons.css">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ url_for('.static', filename='css/style.css') }}"
|
||||
/>
|
||||
<title>{% block title %} SKA Referee Test {% endblock %}</title>
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
|
||||
{% block navbar %}
|
||||
{% include "quiz/components/navbar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="container quiz-container">
|
||||
{% block top_alerts %}
|
||||
{% include "quiz/components/server-alerts.html" %}
|
||||
{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<footer class="container site-footer">
|
||||
{% include "quiz/components/footer.html" %}
|
||||
</footer>
|
||||
|
||||
<!-- JQuery, Popper, and Bootstrap js dependencies -->
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.6.0.min.js"
|
||||
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"
|
||||
integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB"
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"
|
||||
integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<!-- Custom js -->
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ url_for('.static', filename='js/script.js') }}"
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
0
ref-test/quiz/templates/quiz/components/footer.html
Normal file
0
ref-test/quiz/templates/quiz/components/footer.html
Normal file
5
ref-test/quiz/templates/quiz/components/navbar.html
Normal file
5
ref-test/quiz/templates/quiz/components/navbar.html
Normal file
@ -0,0 +1,5 @@
|
||||
<nav class="navbar fixed-top navbar-expand-md navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a href="/" class="navbar-brand mb-0 h1">SKA Refereeing Test </a>
|
||||
</div>
|
||||
</nav>
|
24
ref-test/quiz/templates/quiz/index.html
Normal file
24
ref-test/quiz/templates/quiz/index.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "quiz/components/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>SKA Refereeing Theory Exam</h1>
|
||||
|
||||
<p>
|
||||
This app will allow you to take the Exam on-line. This app should also allow you to adjust the way the quiz is rendered to suit your access needs. This could include using a screen reader, changing the display font size or typeface, or navigating questions and answers via the keyboard.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Instructions
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Other Info
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When you are ready to begin the quiz, click the following button.
|
||||
</p>
|
||||
|
||||
<a href="{{ url_for('quiz_views.start') }}" class="btn btn-success">Take the Quiz</a>
|
||||
|
||||
{% endblock %}
|
0
ref-test/quiz/templates/quiz/privacy.html
Normal file
0
ref-test/quiz/templates/quiz/privacy.html
Normal file
43
ref-test/quiz/templates/quiz/start-quiz.html
Normal file
43
ref-test/quiz/templates/quiz/start-quiz.html
Normal file
@ -0,0 +1,43 @@
|
||||
{% extends "quiz/components/base.html" %}
|
||||
{% import "bootstrap/wtf.html" as wtf %}
|
||||
|
||||
{% block content %}
|
||||
<div class="form-container">
|
||||
<form name="form-quiz-start" class="form-quiz-start">
|
||||
<h2 class="form-heading">Take the Exam</h2>
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="form-label-group">
|
||||
{{ form.first_name(class_="form-control", autofocus=true, placeholder="Enter First Name(s)") }}
|
||||
{{ form.first_name.label }}
|
||||
</div>
|
||||
<div class="form-label-group">
|
||||
{{ form.surname(class_="form-control", placeholder="Enter Surname") }}
|
||||
{{ form.surname.label }}
|
||||
</div>
|
||||
<div class="form-label-group">
|
||||
{{ form.email(class_="form-control", placeholder="Enter Email Address") }}
|
||||
{{ form.email.label }}
|
||||
</div>
|
||||
<div class="form-label-group">
|
||||
{{ form.club(class_="form-control", placeholder="Enter Affiliated Club") }}
|
||||
{{ form.club.label }}
|
||||
</div>
|
||||
<div class="form-label-group">
|
||||
{{ form.auth_code(class_="form-control auth-code-input", placeholder="Enter Exam Code") }}
|
||||
{{ form.auth_code.label }}
|
||||
</div>
|
||||
<div class="form-label-group">
|
||||
{{ form.user_code(class_="form-control", placeholder="Enter User Code") }}
|
||||
{{ form.user_code.label }}
|
||||
</div>
|
||||
{% include "admin/components/client-alerts.html" %}
|
||||
<div class="container form-submission-button">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-md btn-success btn-block" type="submit">Start Quiz</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,8 +1,9 @@
|
||||
from flask import Blueprint
|
||||
from flask import Blueprint, render_template
|
||||
|
||||
views = Blueprint(
|
||||
'quiz_views',
|
||||
__name__,
|
||||
static_url_path='',
|
||||
template_folder='templates',
|
||||
static_folder='static'
|
||||
)
|
||||
@ -10,7 +11,13 @@ views = Blueprint(
|
||||
@views.route('/')
|
||||
@views.route('/home/')
|
||||
def home():
|
||||
return f'<h1>Ref Test Home Page</h1>'
|
||||
return render_template('/quiz/index.html')
|
||||
|
||||
@views.route('/start/', methods = ['GET', 'POST'])
|
||||
def start():
|
||||
from .forms import StartQuiz
|
||||
form = StartQuiz()
|
||||
return render_template('/quiz/start-quiz.html', form=form)
|
||||
|
||||
@views.route('/privacy/')
|
||||
def privacy():
|
||||
|
Reference in New Issue
Block a user