diff options
author | 2018-08-07 15:09:08 +0100 | |
---|---|---|
committer | 2018-08-07 15:09:16 +0100 | |
commit | af54db6c136138c66cf5ca72419989525a0baa5c (patch) | |
tree | 8519aeab8d45277c51797c7dc23aacf3b56ed1bb /templates/main/jams | |
parent | A wizard is never late, nor is he early. (diff) |
Initial project layout for django
Diffstat (limited to 'templates/main/jams')
-rw-r--r-- | templates/main/jams/already.html | 26 | ||||
-rw-r--r-- | templates/main/jams/banned.html | 44 | ||||
-rw-r--r-- | templates/main/jams/index.html | 144 | ||||
-rw-r--r-- | templates/main/jams/info.html | 128 | ||||
-rw-r--r-- | templates/main/jams/join.html | 362 | ||||
-rw-r--r-- | templates/main/jams/profile.html | 103 | ||||
-rw-r--r-- | templates/main/jams/retract.html | 61 | ||||
-rw-r--r-- | templates/main/jams/retracted.html | 31 | ||||
-rw-r--r-- | templates/main/jams/team_list.html | 106 | ||||
-rw-r--r-- | templates/main/jams/team_view.html | 291 | ||||
-rw-r--r-- | templates/main/jams/thanks.html | 25 |
11 files changed, 0 insertions, 1321 deletions
diff --git a/templates/main/jams/already.html b/templates/main/jams/already.html deleted file mode 100644 index 16cba149..00000000 --- a/templates/main/jams/already.html +++ /dev/null @@ -1,26 +0,0 @@ -{% 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 Jam {{ jam.number }}: {{ jam.title }} - </h1> - <p class="uk-article-meta"> - Bring the thunder! - </p> - - <p class="uk-alert uk-alert-danger"> - Thanks for your interest in this code jam! It looks like we already have an application here for you, - so please just sit back, relax, and we'll let you know whether you've been selected for this code - jam when the time comes. - </p> - - <a class="uk-button uk-button-secondary uk-align-center" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back to all code jams - </a> - </div> -</div> -{% endblock %} diff --git a/templates/main/jams/banned.html b/templates/main/jams/banned.html deleted file mode 100644 index fa47c1ec..00000000 --- a/templates/main/jams/banned.html +++ /dev/null @@ -1,44 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | Banned{% endblock %} -{% block og_title %}Code Jams | Banned{% endblock %} - -{% block content %} -<div class="uk-section"> - <div class="uk-container uk-container-small"> - <h1 class="uk-header uk-article-title"> - Code Jam {{ jam.number }}: {{ jam.title }} - </h1> - <p class="uk-article-meta"> - Bring the thunder! - </p> - - {% if infraction.number == -1 %} - <p class="uk-alert uk-alert-danger"> - Thanks for your interest in this code jam! Unfortunately, due to your previous actions, you have been - permanently banned from participating in our code jams. - <br /> - <br /> - The reason given is: <strong>{{ infraction.reason }}</strong> - <br /> - <br /> - If you feel that this is a mistake, please feel free to contact one of the admins on Discord. - </p> - {% else %} - <p class="uk-alert uk-alert-danger"> - Thanks for your interest in this code jam! Unfortunately, due to your previous actions, you have been - temporarily banned from participating in our code jams. - <br /> - <br /> - The reason given is: <strong>{{ infraction.reason }}</strong> - <br /> - <br /> - If you feel that this is a mistake, please feel free to contact one of the admins on Discord. - </p> - {% endif %} - - <a class="uk-button uk-button-secondary uk-align-center" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back to all code jams - </a> - </div> -</div> -{% endblock %} diff --git a/templates/main/jams/index.html b/templates/main/jams/index.html deleted file mode 100644 index 3546bd71..00000000 --- a/templates/main/jams/index.html +++ /dev/null @@ -1,144 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | Home{% endblock %} -{% block og_title %}Code Jams | Home{% endblock %} -{% block page_classes %}uses-rst{% endblock %} -{% block content %} -<div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <div uk-grid class="uk-grid-large"> - <div class="uk-width-expand"> - <h1 class="uk-article-title"> - Code Jams - </h1> - <p class="uk-article-meta"> - We jammin' - </p> - - <p> - Every three months or so, we aim to host a server-wide code jam, suitable for all members of the server. In - these, we announce a theme and date in advance, and users may sign up via a link provided in the - announcements channel on the server. Once the sign-up period is over, users are grouped into - teams. On the day of the code jam, we announce a task - each team will then work on a solution - to this task. - </p> - <p> - Once the code jam is over, our staff team will review and test each submission. Once that's done, - a winner will be decided! - </p> - <p> - If you'd like to join one of our code jams, feel free to ask a member of staff about the next one. - </p> - </div> - - <figure class="jetbrains uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s"> - <h1 class="uk-article-title"> - Sponsors - </h1> - <p class="uk-article-meta"> - Our generous benefactors - </p> - - <a href="https://jetbrains.com"> - <img src="{{ static_file("images/jetbrains.png") }}" class="jam-image"/> - </a> - </figure> - </div> - - <br /> - <a href="{{ url_for("wiki.page", page="jams") }}" class="uk-button uk-button-secondary"> - <i class="uk-icon fa-fw far fa-book"></i> Wiki - </a> - <a href="{{ url_for("wiki.page", page="jams") }}" class="uk-button uk-button-secondary"> - <i class="uk-icon fa-fw far fa-list"></i> Rules & Guidelines - </a> - <a href="{{ url_for("main.jams.info") }}" class="uk-button uk-button-secondary"> - <i class="uk-icon fa-fw far fa-code-branch"></i> Git Primer - </a> - - {% if jams %} - {% for jam in jams %} - <h1 class="uk-article-title"> - Code Jam {{ jam.number }}: {{ jam.title }} - <span class="uk-float-right"> - {% if jam.state == "announced" %} - {% if has_applied_to_jam(jam) %} - <a class="uk-button uk-button-default uk-disabled" href="#"> - <i class="uk-icon fa-fw far fa-check"></i> Applied - </a> - {% else %} - <a class="uk-button uk-button-primary" href="{{ url_for("main.jams.join", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-plus"></i> Join - </a> - {% endif %} - {% else %} - {% if jam.teams and jam.teams | length > 0 %} - <a class="uk-button uk-button-primary" href="{{ url_for('main.jams.jam_team_list', jam_id=jam.number) }}"> - <i class="uk-icon fa-fw far fa-users"></i> Teams - </a> - {% endif %} - <a class="uk-button uk-button-default" target="_blank" href="{{ jam.repo }}"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> - </a> - {% endif %} - </span> - <p class="uk-article-meta"> - State: {{ jam.state.title() }} - </p> - </h1> - <div class="uk-grid-match uk-grid-small uk-text-center uk-grid-gap-none uk-grid-collapse jam-tiles uk-margin-small-top" uk-grid> - <div class="uk-width-1-2@m uk-tile uk-tile-success uk-padding-small"> - <p class="uk-h4 jam-tile-text">Start: {{ format_datetime(jam.date_start) }} UTC</p> - </div> - <div class="uk-width-1-2@m uk-tile uk-tile-danger uk-padding-small"> - <p class="uk-h4 jam-tile-text">End: {{ format_datetime(jam.date_end) }} UTC</p> - </div> - {% if jam.participants %} - {% if jam.winning_team %} - <a href="{{ url_for('main.jams.jam_team_list', jam_id=jam.number) }}" class="uk-link-reset uk-width-1-2@m uk-tile uk-tile-primary uk-padding-small"> - <p class="uk-h4 jam-tile-text">Participants: {{ jam.participants | length }}</p> - </a> - <a href="{{ url_for('main.jams.team_view', team_id=jam.winning_team.id) }}" class="uk-link-reset uk-width-1-2@m uk-tile uk-tile-winner uk-padding-small"> - <p class="uk-h4 jam-tile-text">Champions: {{ jam.winning_team.name }}</p> - </a> - {% else %} - <a href="{{ url_for('main.jams.jam_team_list', jam_id=jam.number) }}" class="uk-link-reset uk-width-1-1@m uk-tile uk-tile-primary uk-padding-small"> - <p class="uk-h4 jam-tile-text">Participants: {{ jam.participants | length }}</p> - </a> - {% endif %} - {% endif %} - </div> - <p> - {% if jam.state in ["running", "judging", "finished"] %} - <span class="uk-label uk-align-right theme-label"> - Theme: {{ jam.theme }} - </span> - {% endif %} - <p> - - </p> - - {{ jam.info_html | safe }} - - {% if jam.state in ["running", "judging", "finished"] %} - <br /> - - {{ jam.task_html | safe }} - {% endif %} - - {% if jam.state == "finished" %} - <br /> - - {{ jam.end_html | safe }} - {% endif %} - - {% endfor %} - {% else %} - <p> - Looking for our code jams? There's nothing here just yet! - </p> - {% endif %} - </article> - </div> -</div> -{% endblock %} diff --git a/templates/main/jams/info.html b/templates/main/jams/info.html deleted file mode 100644 index 920256a6..00000000 --- a/templates/main/jams/info.html +++ /dev/null @@ -1,128 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | Git Primer{% endblock %} -{% block og_title %}Code Jams | Git Primer{% endblock %} -{% block og_description %}Information about our code jams - monthly events where users are grouped into pairs to solve a Python task{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h2 class="uk-article-title hover-title" id="getting-started"> - Getting Started - - <a href="#getting-started" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h2> - <p class="uk-article-meta"> - Git good - Dropbox bad - </p> - <p> - All of our code jams happen on <a href="http://gitlab.com/">GitLab</a>. If you don't have an - account there, you'll need to create one before you can join one of our code jams. Teams are required - to fork the repository we have set up for the current code jam, commit their code to their fork, and - then open a merge request with their project on the code jam repository. - </p> - <p> - Once the challenge task has been announced, head to the link provided to reach the challenge repository. - In order to work on the task, you will need to fork the repository - this will create a copy of the - repository under your account, which you will be able to work on with your teammates. To do so, - log into GitLab and click on the "Fork" button on the repository page. Select your username from the - dialogue, and it will be forked to your account. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_1.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_2.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Once this has been done, you should find yourself looking at your new copy of the repository. Next - up, you'll need to give your teammates access to it! Click on the "Settings" tab, click on - "Collaborators", enter your password if you're prompted for it, and add your teammates as - collaborators. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_3.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_4.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_5.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Now that you've set up your repository, it's time to install Git. If you're on Linux, you can - install Git using your system's package manager. Windows users can install - <a href="https://git-scm.com/download/win">Git for Windows</a>, and Mac users can install Git - using <a href="https://brew.sh">Homebrew</a>. Once you're all installed, open up a terminal - (or open Git Bash if you're on Windows). For the purpose of illustration we will be working on - Windows, but this will work on any platform. - </p> - <p> - We will use Git to clone the repository to the machine. Simply type <code>git clone <url></code> - and Git will download a copy of the repository. The URL is the same one you use to get to the - repository page on GitLab. Use <code>cd project-name</code> to change directory to the repository. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_6.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Now, open the newly-cloned repository in your favourite editor and make some edits. We'll be using - <a href="https://code.visualstudio.com/">Visual Studio Code</a> in this example, but use whatever - you prefer. For example, let's create a file named "hello.py", and add a line of code to it. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_7.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Now that we've edited a file, we need to make Git aware of our changes. Head back over to your - terminal, and type <code>git add hello.py</code> to add this file to our changeset. - </p> - <p> - Next up, we'll need to bundle up our changes into a commit, and push it to GitLab. To do that, we'll - use <code>git commit -am "message"</code>. Make sure you use a descriptive message explaining why - you made your changes and what they are, but try to keep it to a single line of text if you can. - Following this, we can use <code>git push origin master</code> to push our commit up to GitLab. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_8.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_9.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - In order to pull the latest version of the code when the repository was cloned earlier, we can - simply use the <code>git pull</code> command. In order to illustrate this, we will need to enlist - the help of our lovely assistant... - </p> - <figure> - <img src="{{ static_file('images/jams/jams_10.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_11.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_12.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Oh boy. - </p> - <p> - Once you've pushed some code to the repository, you will notice a "Merge request" link. Click on - that to create a merge request, which will let us know that you're working on the task and help us - to keep track of things. Simply click on the "Create merge request" button on the next page, fill - in the "Title" box with your team number - for example, "Team 1" - and click the big green - button to finish. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_13.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_14.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_15.png') }}" class="uk-align-center uk-border-rounded" /> - <img src="{{ static_file('images/jams/jams_16.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - Now that your merge request has been created, keep working on your project! Code that you push to - GitLab will automatically be added to your merge request in real-time. As the code jam continues on, - you may find review comments waiting from us. These are just suggestions to help you improve as - a programmer - free advice from us. Feel free to incorporate our suggestions into your project - if you wish. - </p> - <figure> - <img src="{{ static_file('images/jams/jams_17.png') }}" class="uk-align-center uk-border-rounded" /> - </figure> - <p> - That's all there is to it! Keep working at your task, do your best and you might just come out - on top! - </p> - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/main/jams/join.html b/templates/main/jams/join.html deleted file mode 100644 index 4ff645b8..00000000 --- a/templates/main/jams/join.html +++ /dev/null @@ -1,362 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | Join{% endblock %} -{% block og_title %}Code Jams | Join{% endblock %} -{% block page_classes %}uses-rst{% endblock %} - -{% macro show_question(question) %} - <div id="div-{{ question.id }}"> - <div class="uk-form-label"> - {% if question.optional %} - <label class="uk-form-label question-label" for="{{ question.id }}"> - <strong>{{ question.title }}</strong> - <br /> - <span class="uk-text-meta">You may skip this question</span> - </label> - {% else %} - <label class="uk-form-label question-label" for="{{ question.id }}"> - <strong>{{ question.title }}</strong> - <br /> - <span class="uk-text-meta">This question is required</span> - </label> - {% endif %} - </div> - <div class="uk-form-controls uk-form-controls-text"> - {% if question.type == "checkbox" %} - {% if question.optional %} - <input class="uk-checkbox" type="checkbox" name="{{ question.id }}" id="{{ question.id }}"> - <label for="{{ question.id }}" class="checkbox-label">Confirm</label> - {% else %} - <input class="uk-checkbox" type="checkbox" name="{{ question.id }}" id="{{ question.id }}" required> - <label for="{{ question.id }}" class="checkbox-label">Confirm</label> - {% endif %} - - {% elif question.type == "email" %} - {% if question.optional %} - <input class="uk-input" type="email" name="{{ question.id }}" id="{{ question.id }}" placeholder="[email protected]"> - {% else %} - <input class="uk-input" type="email" name="{{ question.id }}" id="{{ question.id }}" placeholder="[email protected]" required> - {% endif %} - - {% elif question.type == "number" %} - {% if question.optional %} - <input class="uk-input" type="number" max="{{ question.data.max }}" min="{{ question.data.min }}" name="{{ question.id }}" id="{{ question.id }}" value="{{ question.data.min }}"> - {% else %} - <input class="uk-input" type="number" max="{{ question.data.max }}" min="{{ question.data.min }}" name="{{ question.id }}" id="{{ question.id }}" value="{{ question.data.min }}" required> - {% endif %} - - {% elif question.type == "radio" %} - {% if question.optional %} - {% for option in question.data.options %} - <input class="uk-radio radio-{{ question.id }}" type="radio" name="{{ question.id }}" id="{{ question.id }}-{{ option }}" value="{{ option }}"> - <label class="radio-label" for="{{ question.id }}-{{ option }}">{{ option }}</label> - {% endfor %} - {% else %} - {% for option in question.data.options %} - <input class="uk-radio radio-{{ question.id }}" type="radio" name="{{ question.id }}" id="{{ question.id }}-{{ option }}" value="{{ option }}" required> - <label class="radio-label" for="{{ question.id }}-{{ option }}">{{ option }}</label> - {% endfor %} - {% endif %} - - {% elif question.type == "range" %} - <div class="uk-flex uk-flex-between"> - {% if question.optional %} - {% for num in range(question.data.min, question.data.max + 1) %} - <span> - <input class="uk-radio radio-{{ question.id }}" type="radio" name="{{ question.id }}" id="{{ question.id }}-{{ num }}" value="{{ num }}"> - <label class="range-label" for="{{ question.id }}-{{ num }}">{{ num }}</label> - </span> - {% endfor %} - {% else %} - {% for num in range(question.data.min, question.data.max + 1) %} - <span> - <input class="uk-radio radio-{{ question.id }}" type="radio" name="{{ question.id }}" id="{{ question.id }}-{{ num }}" value="{{ num }}" required> - <label class="range-label" for="{{ question.id }}-{{ num }}">{{ num }}</label> - </span> - {% endfor %} - {% endif %} - </div> - - {% elif question.type == "text" %} - {% if question.optional %} - <input class="uk-input" type="text" name="{{ question.id }}" id="{{ question.id }}"> - {% else %} - <input class="uk-input" type="text" name="{{ question.id }}" id="{{ question.id }}" required> - {% endif %} - - {% elif question.type == "textarea" %} - {% if question.optional %} - <textarea class="uk-input uk-textarea fira-code textarea" name="{{ question.id }}" id="{{ question.id }}"></textarea> - {% else %} - <textarea class="uk-input uk-textarea fira-code textarea" name="{{ question.id }}" id="{{ question.id }}" required></textarea> - {% endif %} - - {% elif question.type == "slider" %} - <div class="uk-flex uk-flex-between"> - <label class="uk-label slider-label" for="{{ question.id }}" id="{{ question.id }}-slider-value">{{ question.data.min }}</label> - <input class="uk-range range-slider" name="{{ question.id }}" id="{{ question.id }}" min="{{ question.data.min }}" max="{{ question.data.max }}" step="1" value="{{ question.data.min }}" type="range"> - </div> - - {% endif %} - </div> - </div> -{% endmacro %} - -{% block content %} -<div class="uk-section"> - <div class="uk-container uk-container-small"> - <h1 class="uk-header uk-article-title"> - Code Jam {{ jam.number }}: {{ jam.title }} - </h1> - <p class="uk-article-meta"> - Bring the thunder! - </p> - <p> - Please fill out the form below to apply for this code jam. Once you've submitted your application and the - application window has closed, we'll review it and let you know whether you've been entered! - </p> - <p> - Please note that you will not be able to edit your application after you've submitted it. - </p> - <hr class="uk-divider-icon" /> - - {{ form.preamble_html | safe }} - - <hr class="uk-divider-icon" /> - - {% if jam.state != "announced" %} - <p class="uk-alert uk-alert-primary"> - Unfortunately, we're not accepting applications for this code jam right now - but we appreciate your - interest. Keep an eye on <code>#announcements</code> on Discord for information on the next jam! - </p> - {% else %} - <form action="{{ url_for("main.jams.join", jam=jam.number) }}" method="post" class="uk-form-horizontal uk-flex uk-flex-column"> - {% for question in questions %} - {{ show_question(question) }} - <br /> - {% endfor %} - <br /> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-text-center"> - <a class="uk-button uk-button-default" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button type="submit" class="uk-button uk-button-primary" name="submit" id="submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Apply - </button> - </div> - </form> - - {% endif %} - </div> -</div> - -<script type="application/javascript"> - "use strict"; - - // noinspection JSAnnotator (It thinks I'm not assigning this for some reason) - const questions = {{ questions | tojson }}; - const button = document.getElementById("submit"); - - function validateEmail(email) { - let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return re.test(String(email).toLowerCase()); - } - - function isNum(value) { - return !isNaN(parseInt(value)); - } - - function checkInputs() { - let input, inputs, div; - let disabled = false; - - for (let question of questions) { - div = document.getElementById("div-" + question.id); - - switch (question.type) { - case "checkbox": - if (!question.optional) { - let input = document.getElementById(question.id); - - if (!input.checked) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - break; - case "email": - input = document.getElementById(question.id); - - if (!question.optional || input.value.length > 0) { - if (input.value.length < 5 || !validateEmail(input.value)) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } else { - div.classList.remove("danger-input"); - } - break; - case "number": - input = document.getElementById(question.id); - - if (!question.optional || input.value.length > 0) { - if (input.value.length < 1 || !isNum(input.value)) { - disabled = true; - div.classList.add("danger-input"); - } else { - let val = parseInt(input.value); - - if (val < question.data.min || val > question.data.max) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - } - break; - case "radio": - if (! question.optional) { - inputs = document.getElementsByClassName("radio-" + question.id); - let selected = null; - - for (let inner of inputs) { - if (inner.checked) { - selected = inner; - } - } - - if (selected === null) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - - break; - case "range": - if (! question.optional) { - inputs = document.getElementsByClassName("radio-" + question.id); - let selected = null; - - for (let inner of inputs) { - if (inner.checked) { - selected = inner; - } - } - - if (selected === null) { - disabled = true; - - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - - break; - case "text": - if (!question.optional) { - input = document.getElementById(question.id); - - if (input.value.length < 1) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - - break; - case "textarea": - if (!question.optional) { - input = document.getElementById(question.id); - - if (input.value.length < 1) { - disabled = true; - div.classList.add("danger-input"); - } else { - div.classList.remove("danger-input"); - } - } - - break; - case "slider": - break; - } - } - - button.disabled = disabled; - } - - function setUpChecks() { - let input, inputs, label; - - for (let question of questions) { - switch (question.type) { - case "checkbox": - input = document.getElementById(question.id); - input.onchange = checkInputs; - - break; - case "email": - input = document.getElementById(question.id); - input.oninput = checkInputs; - - break; - case "number": - input = document.getElementById(question.id); - input.oninput = checkInputs; - input.onchange = checkInputs; - - break; - case "radio": - inputs = document.getElementsByClassName("radio-" + question.id); - - for (let inner of inputs) { - inner.onchange = checkInputs; - } - - break; - case "range": - inputs = document.getElementsByClassName("radio-" + question.id); - - for (let inner of inputs) { - inner.onchange = checkInputs; - } - - break; - case "text": - input = document.getElementById(question.id); - input.oninput = checkInputs; - - break; - case "textarea": - input = document.getElementById(question.id); - input.oninput = checkInputs; - - break; - case "slider": - input = document.getElementById(question.id); - label = document.getElementById(question.id + "-slider-value"); - - input.oninput = function() { - label.textContent = this.value; - checkInputs(); - }; - break; - } - } - } - - setUpChecks(); - checkInputs(); -</script> -{% endblock %} diff --git a/templates/main/jams/profile.html b/templates/main/jams/profile.html deleted file mode 100644 index 40d22490..00000000 --- a/templates/main/jams/profile.html +++ /dev/null @@ -1,103 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | My Profile{% endblock %} -{% block og_title %}Code Jams | My Profile{% endblock %} - -{% block content %} -<div class="uk-section"> - <div class="uk-container uk-container-small"> - <h1 class="uk-header uk-article-title"> - Code Jams: My Profile - </h1> - - {% if done %} - <p class="uk-alert uk-alert-success"> - Thanks - your data has been saved! - </p> - {% else %} - <p class="uk-alert uk-alert-primary"> - Please make sure you've filled this out correctly, as we do use this data when evaluating your code jam - application. - <br /> - <br /> - You may come back here and edit your data at any time. - </p> - {% endif %} - - {% if form %} - <form class="uk-form-horizontal" action="{{ url_for("main.jams.profile", form=form) }}" method="post"> - {% else %} - <form class="uk-form-horizontal" action="{{ url_for("main.jams.profile") }}" method="post"> - {% endif %} - - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="gitlab_username">GitLab Username</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input class="uk-input" type="text" name="gitlab_username" id="gitlab_username" value="{{ participant.gitlab_username }}" required> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="timezone">Timezone</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input class="uk-input" type="text" name="timezone" id="timezone" value="{{ participant.timezone }}" required> - </div> - </div> - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - <br /> - - <div class="uk-text-center"> - <a class="uk-button uk-button-default" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button type="submit" class="uk-button uk-button-primary" id="submit"> - <i class="uk-icon fa-fw far fa-check"></i> 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> Delete - </a> - {% else %} - <a class="uk-button uk-button-default uk-text-muted uk-link-muted cursor-default" - 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> Delete - </a> - {% endif %} - </div> - </form> - </div> -</div> - - - -<script type="application/javascript"> - const tz = moment().format("Z"); - - const gitlab_input = document.getElementById("gitlab_username"); - const tz_input = document.getElementById("timezone"); - - const submit_button = document.getElementById("submit"); - - function checkInputs() { - if (gitlab_input.value.length < 1) - return submit_button.disabled = true; - - if (tz_input.value.length < 1) - return submit_button.disabled = true; - - submit_button.disabled = false; - } - - gitlab_input.oninput = checkInputs; - tz_input.oninput = checkInputs; - - if (tz_input.value.length < 1) { - document.getElementById("timezone").value = "UTC" + tz; - } - - checkInputs(); -</script> -{% endblock %} diff --git a/templates/main/jams/retract.html b/templates/main/jams/retract.html deleted file mode 100644 index e013337b..00000000 --- a/templates/main/jams/retract.html +++ /dev/null @@ -1,61 +0,0 @@ -{% 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, GitLab 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, GitLab 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> Cancel - </a> - <button class="uk-button uk-button-danger" type="submit"> - <i class="uk-icon fa-fw fas fa-bomb"></i> 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> Back - </a> - {% endif %} - </div> -</div> -{% endblock %} diff --git a/templates/main/jams/retracted.html b/templates/main/jams/retracted.html deleted file mode 100644 index b67b6497..00000000 --- a/templates/main/jams/retracted.html +++ /dev/null @@ -1,31 +0,0 @@ -{% 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> Back to code jams - </a> - </div> -</div> -{% endblock %} diff --git a/templates/main/jams/team_list.html b/templates/main/jams/team_list.html deleted file mode 100644 index 75c48337..00000000 --- a/templates/main/jams/team_list.html +++ /dev/null @@ -1,106 +0,0 @@ -{% extends "main/base.html" %} - -{% block title %} - {% if user_teams %} - Code Jams | My Teams - {% else %} - Code Jams | Code Jam {{ jam.number }} Teams - {% endif %} -{% endblock %} -{% block og_title %} - {% if user_teams %} - Code Jams | My Teams - {% else %} - Code Jams | Code Jam {{ jam.number }} Teams - {% endif %} -{% endblock %} - -{% block page_classes %}jam-team-list{% endblock %} - -{% block content %} - <div class="uk-section"> - <div class="uk-container"> - <h1 class="uk-header uk-article-title uk-heading-divider"> - {% if user_teams %} - Code Jams: My Teams - {% else %} - Code Jam {{ jam.number }}: Teams - {% endif %} - </h1> - {% if not user_teams %} - <p> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> All Jams - </a> - </p> - {% endif %} - {% if teams %} - <div class="uk-flex uk-flex-row uk-flex-wrap uk-flex-center team-list-cards"> - {% for team in teams %} - <div class="uk-card uk-card-default uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left - {% if not user_teams %} - {% if logged_in and user.user_id in member_ids(team.members) %} - team-card-own - {% endif %} - {% if jam.winning_team and jam.winning_team == team.id %} - team-card-winner - {% endif %} - {% endif %} - "> - <div class="uk-card-body"> - <div class="uk-card-title"> - {% if not user_teams %} - {% if logged_in and user.user_id in member_ids(team.members) %} - <i class="uk-icon fa-fw far fa-user team-badge-own" uk-tooltip="Your Team"></i> - {% endif %} - {% if jam.winning_team and jam.winning_team == team.id %} - <i class="uk-icon fa-fw far fa-trophy team-badge-winner" uk-tooltip="Champions"></i> - {% endif %} - {% endif %} - Team <strong>{{ team.name }}</strong> - {% if user_teams %} - <p class="uk-article-meta team-subtitle"> - Code Jam {{ team.jam.number }} - </p> - {% endif %} - </div> - <div class="team-member-avatars"> - {% for member in team.members %} - <a href="https://discordapp.com/users/{{ member.user_id }}" - title="{{ member.username }}#{{ member.discriminator }}" - target="_blank" - class="team-member-avatar-link"> - <img src="{{ member.avatar }}" class="team-member-avatar uk-border-circle"/> - </a> - {% endfor %} - </div> - <div class="team-links"> - <a href="{{ url_for('main.jams.team_view', team_id=team.id) }}" - class="uk-button uk-button-primary"> - <i class="uk-icon fa-fw far fa-eye"></i> View - </a> - {% if team.repo %} - <a href="https://gitlab.com/{{ team.repo }}" target="_blank" - class="uk-button uk-button-default"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> - </a> - {% else %} - <a href="#" target="_blank" class="uk-button uk-button-darkish uk-disabled"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> - </a> - {% endif %} - </div> - </div> - </div> - {% endfor %} - </div> - {% else %} - {% if user_teams %} - <p>You are not part of any team.</p> - {% else %} - <p>There are no teams in this jam.</p> - {% endif %} - {% endif %} - </div> - </div> -{% endblock %} diff --git a/templates/main/jams/team_view.html b/templates/main/jams/team_view.html deleted file mode 100644 index 0554c3d4..00000000 --- a/templates/main/jams/team_view.html +++ /dev/null @@ -1,291 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Team {{ team.name }}{% endblock %} -{% block og_title %}Team {{ team.name }}{% endblock %} - -{% block page_classes %}jam-team-view{% endblock %} - -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <h1 class="uk-header uk-article-title"> - Team <strong>{{ team.name }}</strong> - </h1> - <p class="uk-article-meta"> - Code Jam {{ team.jam.number }} - </p> - <p> - <a href="{{ url_for('main.jams.jam_team_list', jam_id=team.jam.number) }}" - class="uk-button uk-button-default"> - <i class="uk-icon fa-fw far fa-users"></i> Competing Teams - </a> - {% if logged_in %} - <a href="{{ url_for('main.jams.user_team_list') }}" - class="uk-button uk-button-default"> - <i class="uk-icon fa-fw far fa-user"></i> My Teams - </a> - {% endif %} - </p> - - <div class="uk-grid"> - <div class="uk-width-1-2@m"> - <h2> - Team Members - </h2> - <div class="participant-card-list"> - {% for member in team.members %} - <div class="participant-card uk-card-default"> - <a href="https://discordapp.com/users/{{ member.user_id }}" target="_blank" - class="participant-avatar-link"> - <img src="{{ member.avatar }}" class="uk-border-circle participant-avatar"> - </a> - <strong>{{ member.username }}#{{ member.discriminator }}</strong> - <div class="participant-links"> - <a href="https://gitlab.com/{{ member.gitlab_username }}" target="_blank" - class="uk-button uk-button-default"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> - </a> - </div> - </div> - {% endfor %} - </div> - </div> - <div class="uk-width-1-2@m"> - <h2> - Activity - </h2> - <p> - {% if team.repo %} - <a href="https://gitlab.com/{{ team.repo }}" target="_blank" - class="uk-button uk-button-primary"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> View on GitLab - </a> - {% else %} - <a href="https://gitlab.com/{{ team.repo }}" target="_blank" id="view-repo-button" - class="uk-button uk-button-darkish uk-disabled"> - <i class="uk-icon fa-fw fab fa-gitlab"></i> View on GitLab - </a> - {% endif %} - {% if is_own_team %} - <a class="uk-button uk-button-default" id="edit-repo-button"> - <i class="uk-icon fa-fw far fa-pencil"></i> - </a> - {% endif %} - </p> - <div id="gitlab-activity" class="gitlab-activity uk-card-default - {% if not team.repo %} - uk-hidden - {% endif %} - "> - <div id="gitlab-activity-loading" class="gitlab-activity-loading"> - <div class="gitlab-activity-loading-content"> - <p> - Loading GitLab activity, hang tight... - </p> - <div uk-spinner class="gitlab-activity-spinner"></div> - </div> - </div> - </div> - </div> - </div> - </div> - </div> - {% if is_own_team %} - <div id="repo-modal" class="uk-flex-top" uk-modal> - <div class="uk-modal-dialog"> - <button class="uk-modal-close-default" type="button" uk-close></button> - - <div class="uk-modal-header"> - <h2 class="uk-modal-title">Edit Repository</h2> - </div> - <form> - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - <div class="uk-modal-body"> - <p> - Enter your team's GitLab repository URL in the field below. - </p> - <p> - Note: it should be a fork of the jam's GitLab repository - (<strong>{{ team.jam.repo }}</strong>). - </p> - <div class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="repo-url">Repository URL</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" type="text" name="repo-url" id="repo-url" - value="https://gitlab.com/{{ team.repo }}" required> - </div> - </div> - </div> - </div> - - <div class="uk-modal-footer"> - <div class="uk-text-center"> - <button class="uk-button uk-button-default uk-modal-close" type="button" id="repo-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Cancel - </button> - <a class="uk-button uk-button-primary" id="repo-submit"> - <i class="uk-icon fa-fw far fa-check"></i> Save - </a> - </div> - </div> - </form> - </div> - </div> - {% endif %} - <script type="application/javascript"> - "use strict"; - - {% if is_own_team %} - /* Modal */ - - const csrf_token = "{{ csrf_token() }}"; - const repo_edit_target = "{{ url_for('main.jams.team.edit_repo', team_id=team.id) }}"; - const repo_modal = UIkit.modal(document.getElementById("repo-modal")); - const repo_cancel = document.getElementById("repo-cancel"); - const repo_submit = document.getElementById("repo-submit"); - const repo_url = document.getElementById("repo-url"); - const repo_edit_button = document.getElementById("edit-repo-button"); - - repo_cancel.onclick = function () { - repo_modal.hide(); - }; - - repo_edit_button.onclick = () => { - repo_modal.show(); - }; - - function editTeamRepoURL(repo, callback) { - $.ajax(repo_edit_target, { - "data": {"repo_url": repo}, - "dataType": "json", - "headers": {"X-CSRFToken": csrf_token}, - "method": "POST", - }).done(data => { - if ("error_code" in data) { - return callback(false, data); - } - - return callback(true, data); - }).fail((xhr) => callback(false, xhr["responseJSON"])); - } - - repo_submit.onclick = () => { - repo_submit.classList.add("uk-disabled"); - let repo = repo_url.value; - editTeamRepoURL(repo, (success, data) => { - repo_submit.classList.remove("uk-disabled"); - if (success) { - UIkit.notification({ - "message": "Edited repository successfully", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - - GITLAB_PROJECT_ID = data["project_path"]; - repo_modal.hide(); - resetGitLabActivity(); - } else { - console.log(data); - let message = (data && "error_message" in data) ? `Failed: ${data["error_message"]}` : "Failed to edit repository."; - UIkit.notification({ - "message": message, - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }); - }; - - {% endif %} - - - /* GitLab activity */ - - function resetGitLabActivity() { - $("#gitlab-activity-events").remove(); - $("#gitlab-activity-loading").show(); - $("#gitlab-activity").removeClass("uk-hidden"); - $("#view-repo-button").attr("href", `https://gitlab.com/${GITLAB_PROJECT_ID}`) - .removeClass("uk-button-darkish") - .removeClass("uk-disabled") - .addClass("uk-button-primary"); - loadGitLabActivity(); - } - - let GITLAB_PROJECT_ID = "{{ team.repo }}"; // the gitlab project id - function loadGitLabActivity() { - const GITLAB_EVENT_ACTIONS = ["pushed"]; // the actions to filter in the event list - const JAM_START_DATE = "{{ day_delta(team.jam.date_start, -1).strftime("%Y-%m-%d") }}"; // the start date of the jam, in order to ignore pushes prior to start - const JAM_END_DATE = "{{ day_delta(team.jam.date_end, +1).strftime("%Y-%m-%d") }}"; // the end date of the jam, in order to ignore pushes after the end - const GITLAB_PROJECT_EVENTS_ENDPOINT = () => `https://gitlab.com/api/v4/projects/${encodeURIComponent(GITLAB_PROJECT_ID)}/events?action=${GITLAB_EVENT_ACTIONS.join(",")}&after=${JAM_START_DATE}&before=${JAM_END_DATE}`; - const GITLAB_ACCEPTED_ACTIONS = ["pushed", "created"]; - - function gitlabBranchURL(branch) { - return `https://gitlab.com/${GITLAB_PROJECT_ID}/tree/${branch}` - } - - function gitlabCommitURL(commit) { - return `https://gitlab.com/${GITLAB_PROJECT_ID}/commit/${commit}` - } - - function onEventsLoaded(events) { - $("#gitlab-activity-loading").hide(); - - let eventList = $("<div id=\"gitlab-activity-events\"></div>") - .addClass("gitlab-activity-events"); - - let eventCount = 0; - for (let i = 0; i < events.length; i++) { - let event = events[i]; - if (!GITLAB_ACCEPTED_ACTIONS.includes(event["push_data"]["action"])) { - continue; - } - let commit = event["push_data"]["commit_to"]; - let branch = event["push_data"]["ref"]; - let eventDate = Date.parse(event["created_at"]); - let eventElement = $( - "" - + "<div class=\"gitlab-activity-event-item\">" - + "<div class=\"gitlab-activity-event-item-content\">" - + `<span><strong>${event["author"]["username"]}</strong> pushed: "${event["push_data"]["commit_title"]}"</span>` - + "<br>" - + `<a target=\"blank\" href=\"${gitlabCommitURL(commit)}\" class=\"pasta\">${commit.substring(0, 8)}</a>` - + `<a target=\"blank\" href=\"${gitlabBranchURL(branch)}\" class=\"pasta\"><i class="uk-icon fa-fw far fa-code-branch"></i> ${branch}</a>` - + `` - + "</div>" - + "</div>" - ); - eventList.append(eventElement); - eventCount++; - } - - let footerMessage = eventCount > 0 ? "We've reached the end!" : "There is no activity to show at this time."; - - // add the footer - let eventListFooter = $( - "" - + "<div class=\"gitlab-activity-events-footer\">" - + `<span>${footerMessage}</span>` - + "</div>" - ).appendTo(eventList); - - $("#gitlab-activity").append(eventList); - } - - function onEventsFailed(xhr) { - console.error(xhr); - } - - $.get( - GITLAB_PROJECT_EVENTS_ENDPOINT() - ).done(onEventsLoaded).fail(onEventsFailed); - } - - window.onload = loadGitLabActivity; - </script> -{% endblock %} diff --git a/templates/main/jams/thanks.html b/templates/main/jams/thanks.html deleted file mode 100644 index f123b227..00000000 --- a/templates/main/jams/thanks.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Code Jams | Thanks!{% endblock %} -{% block og_title %}Code Jams | Thanks!{% endblock %} - -{% block content %} -<div class="uk-section"> - <div class="uk-container uk-container-small"> - <h1 class="uk-header uk-article-title"> - Code Jam {{ jam.number }}: {{ jam.title }} - </h1> - <p class="uk-article-meta"> - Bring the thunder! - </p> - - <p class="uk-alert uk-alert-success"> - Thanks for your application! Just sit back, relax, and we'll let you know whether you've been selected - for this code jam when the time comes. - </p> - - <a class="uk-button uk-button-secondary uk-align-center" href="{{ url_for("main.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back to all code jams - </a> - </div> -</div> -{% endblock %} |