aboutsummaryrefslogtreecommitdiffstats
path: root/templates/main/jams
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-05-20 23:29:17 +0100
committerGravatar GitHub <[email protected]>2018-05-20 23:29:17 +0100
commit449d52caf4010ed112f1928bf6b5234bcfb9a339 (patch)
tree3ce59258a68fcb4174610b157f3a3ae9c50be02a /templates/main/jams
parentTests directory (#73) (diff)
Privacy/Usability updates (#75)
* Use less intrusive oauth scopes, add login redirect method * Remove debugging prints, add missing __init__ * Work towards new privacy policy * Fix judging state icons on code jam management page * Jammer profile retraction and punishments based on jam status * Linting * [Jams] Deny profile saving for users < 13 years, and finish removal page * Fix tests * Clean up and address Volcyy's review * Add proper login redirection to require_roles decorator * Fix template is_staff() and add staff link to navigation * Address lemon's review * Linting * Privacy page formatting * Privacy page formatting
Diffstat (limited to 'templates/main/jams')
-rw-r--r--templates/main/jams/profile.html41
-rw-r--r--templates/main/jams/retract.html61
-rw-r--r--templates/main/jams/retracted.html31
3 files changed, 132 insertions, 1 deletions
diff --git a/templates/main/jams/profile.html b/templates/main/jams/profile.html
index efa0e274..cf2088c7 100644
--- a/templates/main/jams/profile.html
+++ b/templates/main/jams/profile.html
@@ -67,6 +67,17 @@
<button type="submit" class="uk-button uk-button-primary" id="submit">
<i class="uk-icon fa-fw far fa-check"></i> &nbsp;Save
</button>
+
+ {% if existing %}
+ <a class="uk-button uk-button-danger" href="{{ url_for("main.jams.retract") }}">
+ <i class="uk-icon fa-fw fas fa-bomb"></i> &nbsp;Delete
+ </a>
+ {% else %}
+ <a class="uk-button uk-button-default uk-text-muted uk-link-muted" style="cursor: default !important"
+ uk-tooltip="title: You can't delete your profile because you haven't submitted one yet!; pos: bottom">
+ <i class="uk-icon fa-fw fas fa-bomb"></i> &nbsp;Delete
+ </a>
+ {% endif %}
</div>
</form>
</div>
@@ -75,19 +86,47 @@
<script type="application/javascript">
- const date = flatpickr("#dob", {enableTime: false, altInput: true});
+ const date = flatpickr("#dob", {
+ enableTime: false, altInput: true, altInputClass: "date-picker",
+ onChange: function() {
+ let dob = moment(dob_input.value);
+
+ if (!dob.isBefore(earliest_dob)) {
+ UIkit.notification({
+ "message": "You must be aged 13 or older to participate in our code jams.",
+ "status": "danger",
+ "pos": "top-center",
+ "timeout": 5000,
+ });
+
+ dob_output.classList.add("uk-form-danger");
+ submit_button.disabled = true;
+ } else {
+ dob_output.classList.remove("uk-form-danger");
+ }
+ }
+ });
+
const tz = moment().format("Z");
const dob_input = document.getElementById("dob");
+ const dob_output = document.getElementsByClassName("date-picker")[0];
const github_input = document.getElementById("github_username");
const tz_input = document.getElementById("timezone");
const submit_button = document.getElementById("submit");
+ const earliest_dob = moment().subtract(13, "years");
function checkInputs() {
if (dob_input.value.length < 1)
return submit_button.disabled = true;
+ let dob = moment(dob_input.value);
+
+ if (!dob.isBefore(earliest_dob)) {
+ return submit_button.disabled = true;
+ }
+
if (github_input.value.length < 1)
return submit_button.disabled = true;
diff --git a/templates/main/jams/retract.html b/templates/main/jams/retract.html
new file mode 100644
index 00000000..bbe3bdae
--- /dev/null
+++ b/templates/main/jams/retract.html
@@ -0,0 +1,61 @@
+{% extends "main/base.html" %}
+{% block title %}Code Jams | Already applied{% endblock %}
+{% block og_title %}Code Jams | Already applied{% endblock %}
+
+{% block content %}
+<div class="uk-section">
+ <div class="uk-container uk-container-small">
+ <h1 class="uk-header uk-article-title">
+ Code Jams: Retract Profile
+ </h1>
+
+ {% if participant %}
+ <p>
+ Are you sure you'd like to retract your code jam profile?
+ </p>
+
+ {% if banned %}
+ <p>
+ Retracting your code jam profile will remove your date of birth, GitHub username and timezone from our
+ database. If you're entirely sure that you'd like to remove your profile, please click on the "Remove" button below.
+ </p>
+
+ <p>
+ As you are currently taking part in a code jam,
+ <strong class="uk-text-danger">this will void your application and you will receive an automatic ban from future code jams</strong>
+ until you've contacted us about it.
+ </p>
+ {% else %}
+ <p>
+ Retracting your code jam profile will remove your date of birth, GitHub username and timezone from our
+ database. If you're entirely sure that you'd like to remove your profile, please click on the "Remove" button below.
+ </p>
+
+ <p>
+ As you are not currently taking part in an ongoing code jam,
+ <strong class="uk-text-primary">you will not be banned from future code jams</strong>.
+ </p>
+ {% endif %}
+
+ <form action="{{ url_for("main.jams.retract") }}" method="post" class="uk-form uk-text-center" uk-form>
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+
+ <a class="uk-button uk-button-primary" href="{{ url_for("main.jams.profile") }}">
+ <i class="uk-icon fa-fw far fa-arrow-left"></i> &nbsp;Cancel
+ </a>
+ <button class="uk-button uk-button-danger" type="submit">
+ <i class="uk-icon fa-fw fas fa-bomb"></i> &nbsp;Remove
+ </button>
+ </form>
+ {% else %}
+ <p class="uk-alert uk-alert-danger">
+ You can't delete your profile - you haven't submitted one to us yet!
+ </p>
+
+ <a class="uk-button uk-button-secondary uk-width-1-1" href="{{ url_for("main.jams.profile") }}">
+ <i class="uk-icon fa-fw far fa-arrow-left"></i> &nbsp;Back
+ </a>
+ {% endif %}
+ </div>
+</div>
+{% endblock %}
diff --git a/templates/main/jams/retracted.html b/templates/main/jams/retracted.html
new file mode 100644
index 00000000..b67b6497
--- /dev/null
+++ b/templates/main/jams/retracted.html
@@ -0,0 +1,31 @@
+{% extends "main/base.html" %}
+{% block title %}Code Jams | Already applied{% endblock %}
+{% block og_title %}Code Jams | Already applied{% endblock %}
+
+{% block content %}
+<div class="uk-section">
+ <div class="uk-container uk-container-small">
+ <h1 class="uk-header uk-article-title">
+ Code Jams: Profile Retracted
+ </h1>
+
+ {% if banned %}
+ <p>
+ Your code jam profile has been deleted. As you were participating in an ongoing code jam, you have
+ been issued with an automatic ban from future code jams. If you'd like to join a code jam in the
+ future, please contact us directly and we'll try to resolve the situation with you. Thanks for your
+ interest in our code jams regardless!
+ </p>
+ {% else %}
+ <p>
+ Your code jam profile has been deleted. you were not participating in an ongoing code jam, no further
+ action is required by you. Thanks for your interest in our code jams regardless!
+ </p>
+ {% endif %}
+
+ <a class="uk-button uk-button-secondary uk-width-1-1" href="{{ url_for("main.jams.index") }}">
+ <i class="uk-icon fa-fw far fa-arrow-left"></i> &nbsp;Back to code jams
+ </a>
+ </div>
+</div>
+{% endblock %}