Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start page #61

Merged
merged 15 commits into from
Feb 16, 2022
10 changes: 7 additions & 3 deletions app/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def index():
return render_template("index.html", title="Mentor matcher")


@main_bp.route("/match", methods=["GET"])
def match():
return render_template("match.html", title="Mentor matcher")


@main_bp.route("/cookies")
def cookies():
return render_template("cookies.html", title="Cookies")
Expand Down Expand Up @@ -63,12 +68,11 @@ def upload():
else:
if len(files) != 2:
error_message = (
"Number of files is incorrect. Please only upload two files"
"Number of files is incorrect. Please only upload two files."
)
elif not valid_files(filenames):
error_message = (
"Filenames incorrect. Please label your files as 'mentees.csv' and"
" 'mentors.csv'"
"Your filenames are incorrect. Please label your files as 'mentees.csv' and 'mentors.csv'."
)
else:
error_message = "Unspecified error. Please contact the admin team"
Expand Down
45 changes: 16 additions & 29 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,21 @@
{% endblock %}
{% block content %}

<div class="grid-row main-wrapper--lg">
<div class="grid-column-full">
<h2>Tasks</h2>
<div class="page--content">
<p>Pick a task length.</p>
<div class="button-group" role="group" aria-label="Basic example">
<button type="button" class="button" onclick="handleClick('small')">50 participants</button>
<button type="button" class="button" onclick="handleClick('large')">500 participants</button>
</div>
</div>
</div>
<div class="grid-row">
<div class="grid-column-two-thirds">
<div class="page--content">
<h2 class="heading-md">Before you start</h2>
<ol>
<li><strong>This tool will only work with data in specific formats.</strong> You must have two files – <code>mentees.csv</code> and <code>mentors.csv</code> – to start the matching process. Those files need to be formatted with specific column headings. You can <a href="https://github.com/jonodrew/mentor-match-package/blob/main/templates/participant.csv">download a template</a> from this website.</li>
<li><strong>Do not close your browser window during the matching process.</strong> Doing this may cause the matching process to fail and you to lose your matches.</li>
<li><strong>The larger the number of matches you need, the longer this takes.</strong> Matching mentors to mentees takes around 10 minutes to match 500 participants.</li>
</ol>
<hr>
<div class="button-group">
<a href="/upload" class="button button--action">Start now</a>
</div>
</div>
</div>
</div>

<dialog class="dialog" id="dialog-box">
<!-- this dialog will only show when required -->
<!-- note that this won't work in Safari yet -->
<section class="dialog--header">
<h2 class="heading-lg dialog--title">Matching complete</h2>
</section>
<section class="dialog--content">
<p>The matching process is complete.</p>
<p>Use the <kbd>Download matches</kbd> button to get the results.</p>
</section>
<footer class="dialog--actions">
<a class="button button--dialog" id="download-matches" title="Download matching results">Download
matches</a>
<button onclick="closeDialog('dialog-box')" class="button button--secondary button--dialog button--close">Close
this dialog</button>
</footer>
</dialog>
{% endblock %}
{% endblock %}
40 changes: 26 additions & 14 deletions app/templates/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,32 @@
{% block head %}
{{ super() }}
{% endblock %}

{% block pagecaption %}Mentor matcher{% endblock %}
{% block pageheading %}Upload your data{% endblock %}
{% block pageexcerpt %}Upload the mentors and mentees you want to match.{% endblock %}

{% block content %}
<h1 class="heading-lg">Upload</h1>
{% if error_message %}
<blockquote class="error warning-text">
<strong>Error:</strong> {{ error_message }}
</blockquote>
{% endif %}
<form method=post enctype=multipart/form-data action="{{ url_for('main.upload') }}">
<div class="form-group" style="padding-bottom: 20px;">
<label class="label label-md" for="files">
Select your files
</label>
<input type="file" name="files" multiple="" id="files">
<div class="grid-row">
<div class="grid-column-two-thirds">
<div class="page--content">
<form method=post enctype=multipart/form-data action="{{ url_for('main.upload') }}">
{% if error_message %}
<blockquote class="error warning-text">
<p><strong>An error has occurred</strong></p>
<p>{{ error_message }}</p>
</blockquote>
{% endif %}
<div class="form-group">
<label class="label label-lg" for="files">
Select your files
</label>
<input type="file" name="files" multiple="" id="files">
</div>
<hr>
<input type="submit" class="button button--action" value="Upload the data ❯">
</form>
</div>
<input type="submit" class="button button--action" value="Upload">
</form>
</div>
</div>
{% endblock %}
21 changes: 9 additions & 12 deletions app/templates/process.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
{% extends 'base.html' %}
{% block title %}Process matches{% endblock %}
{% block head %}{{ super() }}{% endblock %}

{% block pagecaption %}Mentor matcher{% endblock %}
{% block pageheading %}Match mentors to mentees{% endblock %}
{% block pageexcerpt %}Process the data and match mentors to mentees.{% endblock %}

{% block content %}
<div class="grid-row">
<header class="page--header">
<div class="grid-column-full">
<h1 class="page--heading">
Process data
</h1>
</div>
</header>
</div>

<div class="grid-row main-wrapper--lg">
<div class="grid-column-full">
<button class="button" type="button" onclick="handleClick('{{ session['data-folder'] }}')">
Process your data
<button class="button button--action" type="button" onclick="handleClick('{{ session['data-folder'] }}')">
Start matching
</button>
</div>
</div>

<dialog class="dialog" id="dialog-box">
<!-- this dialog will only show when required -->
<!-- note that this won't work in Safari yet -->
<!-- note that this won't work in Safari or Firefox without enabling specific flags as at Feb 2022 -->
<section class="dialog--header">
<h2 class="heading-lg dialog--title">Matching complete</h2>
</section>
Expand Down