9 Commits

Author SHA1 Message Date
a2c52a4261 Corrected value to id property of entry 2023-02-28 20:59:12 +00:00
b2c9bdd7d2 Removed CSRF time limit 2023-02-28 20:37:23 +00:00
7536c33a48 Tidied up form. Removed help text. 2023-02-03 17:08:50 +00:00
850c2b13b7 Data use disclaimer for UI choices 2023-02-03 17:02:32 +00:00
eb69979f59 Spelling consistency advice 2023-02-03 17:02:16 +00:00
95cea46a8f Merge branch 'master' into development 2023-02-03 16:31:41 +00:00
02a1129390 Adding jquery ui css
Nesting script inside jquery function call
2023-02-03 16:26:31 +00:00
438e09f1ec Bugfix: club field selector 2023-02-03 16:15:50 +00:00
9241e1c0f7 Added club suggestion auto-complete 2023-02-03 16:06:06 +00:00
6 changed files with 39 additions and 2 deletions

View File

@ -71,7 +71,7 @@
{% for entry in test.entries %} {% for entry in test.entries %}
<tr> <tr>
<td> <td>
<a href="{{ url_for('admin._view_entry', id=entry) }}" >Entry {{ loop.index }}</a> <a href="{{ url_for('admin._view_entry', id=entry.id) }}" >Entry {{ loop.index }}</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -12,6 +12,7 @@ class Config(object):
SECRET_KEY = os.getenv('SECRET_KEY') SECRET_KEY = os.getenv('SECRET_KEY')
SERVER_NAME = os.getenv('SERVER_NAME') SERVER_NAME = os.getenv('SERVER_NAME')
SESSION_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True
WTF_CSRF_TIME_LIMIT = None
"""Email Engine Configuration""" """Email Engine Configuration"""
MAIL_SERVER = os.getenv('MAIL_SERVER') MAIL_SERVER = os.getenv('MAIL_SERVER')

View File

@ -14,6 +14,9 @@
<div class="container quiz-start-text"> <div class="container quiz-start-text">
You can use this panel to adjust the display settings for the exam. Please use the menu below to select the font face and font size. Below is a sample question so you can see how the exam will render with your chosen settings. You can use this panel to adjust the display settings for the exam. Please use the menu below to select the font face and font size. Below is a sample question so you can see how the exam will render with your chosen settings.
</div> </div>
<div class="container quiz-start-text">
These settings will be stored locally on your browser window. No information about your preferences below will be collected by the app.
</div>
<div class="alert alert-primary quiz-start-text" role="alert"> <div class="alert alert-primary quiz-start-text" role="alert">
<strong>Note</strong>: Some fonts may not be available depending on your device and/or operating system. <strong>Note</strong>: Some fonts may not be available depending on your device and/or operating system.
</div> </div>

View File

@ -56,6 +56,8 @@
integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13"
crossorigin="anonymous" crossorigin="anonymous"
></script> ></script>
<!-- jQuery UI -->
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<!-- Custom js --> <!-- Custom js -->
<script type="text/javascript"> <script type="text/javascript">
var csrf_token = "{{ csrf_token() }}"; var csrf_token = "{{ csrf_token() }}";

View File

@ -1,6 +1,10 @@
{% extends "quiz/components/base.html" %} {% extends "quiz/components/base.html" %}
{% import "bootstrap/wtf.html" as wtf %} {% import "bootstrap/wtf.html" as wtf %}
{% block style %}
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
{% endblock %}
{% block content %} {% block content %}
<div class="form-container"> <div class="form-container">
<form name="form-quiz-start" class="form-quiz-start"> <form name="form-quiz-start" class="form-quiz-start">
@ -43,4 +47,14 @@
</div> </div>
</form> </form>
</div> </div>
{% endblock %}
{% block script %}
<script>
$( function() {
const clubs = {{ clubs|tojson }}
$('#club').autocomplete({
source: clubs
})
} )
</script>
{% endblock %} {% endblock %}

View File

@ -29,6 +29,23 @@ def _instructions():
@quiz.route('/start/', methods=['GET', 'POST']) @quiz.route('/start/', methods=['GET', 'POST'])
def _start(): def _start():
clubs = [
'Dundee Korfball Club',
'Edinburgh City Korfball Club',
'Edinburgh Mavericks Korfball Club',
'Edinburgh University Korfball Club',
'Glasgow Korfball Club',
'Saint Andrews University Korfball Club',
'Strathclyde University Korfball Club'
]
try: entries = Entry.query.all()
except Exception as exception:
write('system.log', f'Database error when processing request \'{request.url}\': {exception}')
return abort(500)
for entry in entries: clubs.append(entry.get_club())
clubs = list(set(clubs))
try: clubs.remove('')
except: pass
form = StartQuiz() form = StartQuiz()
if request.method == 'POST': if request.method == 'POST':
if form.validate_on_submit(): if form.validate_on_submit():
@ -58,7 +75,7 @@ def _start():
}), 200 }), 200
return jsonify({'error': 'There was an error processing the user test and/or user codes.'}), 400 return jsonify({'error': 'There was an error processing the user test and/or user codes.'}), 400
return send_errors_to_client(form=form) return send_errors_to_client(form=form)
return render_template('/quiz/start_quiz.html', form = form) return render_template('/quiz/start_quiz.html', form = form, clubs = clubs)
@quiz.route('/quiz/') @quiz.route('/quiz/')
def _quiz(): def _quiz():