diff options
Diffstat (limited to 'templates')
58 files changed, 0 insertions, 8187 deletions
diff --git a/templates/errors/error.html b/templates/errors/error.html deleted file mode 100644 index dbb7e3b4..00000000 --- a/templates/errors/error.html +++ /dev/null @@ -1,56 +0,0 @@ -{% extends 'main/base.html' %} -{% block title %}Error {{ code }}{% endblock %} -{% block og_title %}Error {{ code }}{% endblock %} -{% block og_description %}{{ error_message | safe }}{% endblock %} - -{% block extra_head %} - <script> - window._RequestMethod = "{{ request.method.lower() }}"; - window._Code = {{ code }}; - window._ErrorMsg = "{{ error_message | safe }}"; - window._Path = "{{ request.path }}"; - window.onload = error_typewriter; - </script> -{% endblock %} - -{% block content %} - <div class="uk-background-muted"> - <div class="uk-container"> - <div class="uk-section uk-text-center uk-panel uk-panel-box"> - <p class="error-header uk-text-large uk-text-break">{{ error_title }}</p> - </div> - </div> - </div> - - <div class="uk-visible@s"> - <div class="uk-container uk-section"> - <div class="window" id="win"> - <div class="top"> - <div class="panel"> - <span id="terminal-close"></span> - <span id="second-button"></span> - <span id="third-button"></span> - </div> - - </div> - - <div class="inside"> - <div class="block"> - <pre id="terminal"><code class="python" id="error"></code></pre> - </div> - </div> - </div> - </div> - </div> - - <div class="uk-hidden@s uk-container uk-text-center"> - <br /> - <p>{{ error_message | safe }}</p> - </div> - - <noscript> - <h1>There was an issue processing your request</h1> - <p>{{ error_message | safe }}</p> - </noscript> -{% endblock %} - diff --git a/templates/main/about/channels.html b/templates/main/about/channels.html deleted file mode 100644 index ac3d95b5..00000000 --- a/templates/main/about/channels.html +++ /dev/null @@ -1,268 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Channels{% endblock %} -{% block og_title %}Channels{% endblock %} -{% block og_description %}Channel listing and what's each channel is for{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Channels - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Keeping things tidy - </p> - - <p> - Every channel on the server has a use, and we expect users to keep things relevant to the channel - whenever possible. Below, we've outlined all of the channels a normal user has access to send - messages to, and what they should be used for. - </p> - - <h2>Discussion</h2> - - <p> - Channels in this section are designated for discussion and chat, and shouldn't be used for help - requests in most cases. All channels in this category are on-topic. - </p> - - <table uk-table class="uk-table-striped uk-table uk-table-divider table-bordered"> - <thead> - <tr> - <th>Channel</th> - <th>Info</th> - </tr> - </thead> - <tbody> - <tr> - <td class="fira-code">#python-discussion</td> - <td> - Discussion about the Python programming language and ecosystem - </td> - </tr> - <tr> - <td class="fira-code">#tools</td> - <td> - Discussion relating to Python tooling - IDEs, editors, package managers, documentation - generators, and so on - </td> - </tr> - <tr> - <td class="fira-code">#meta</td> - <td> - Discussion and suggestions relating to the Discord server, site, bot, and other - projects of ours - </td> - </tr> - </tbody> - </table> - - <h2>Off-Topic</h2> - - <p> - Channels in this section are designated for off-topic <strong>discussion</strong>, and any topic - may be talked about here once it follows our rules. Note that these channels are for discussion, - and are not places for you to dump images or memes. - </p> - - <p> - These channels are renamed daily by the server bot. Suggest funny channel names - <a href="https://gitlab.com/python-discord/meta/issues/8">on the dedicated GitLab meta issue</a>. - </p> - - <h2>Python Help</h2> - - <p> - Channels in this section are strictly on-topic, and designated for asking general Python-related - questions. If you're a beginner or you need some help with your Python, this is probably where you - want to be. - </p> - - <p> - Please try to pick a channel that isn't busy when asking your question. If you're not sure - how best to ask a question, take a look at - <a href="{{ url_for("main.info.help") }}">our guide on that subject</a>. - </p> - - <h2>Topical Chat/Help</h2> - - <p> - Channels in this section are strictly on-topic, and geared towards specific subjects. They can be - used for either discussion or asking questions - if you need help with one of the specific things - covered here, it's best to ask your question in the relevant channel rather than one of the general - help channels. - </p> - - <table uk-table class="uk-table-striped uk-table uk-table-divider table-bordered"> - <thead> - <tr> - <th>Channel</th> - <th>Info</th> - </tr> - </thead> - <tbody> - <tr> - <td class="fira-code">#databases</td> - <td> - Discussion and questions relating to databases - both traditional and document-oriented - - such as SQLite, Postgresql, RethinkDB, Cassandra, Redis and so on - </td> - </tr> - <tr> - <td class="fira-code">#data-science</td> - <td> - Discussion and questions relating to machine learning, natural language processing, - statistics and graphing and so on - </td> - </tr> - <tr> - <td class="fira-code">#dev-ops</td> - <td> - Discussion and questions relating to devops - for example, deployment and configuration - of services, virtual machines and containers, and the day-to-day running of your - Python-powered services - </td> - </tr> - <tr> - <td class="fira-code">#discord-py</td> - <td> - Discussion and questions relating to the - <a href="https://github.com/Rapptz/discord.py">discord.py</a> library for writing - Discord bots in Python - This channel refers specifically to the - <a href="https://discordpy.readthedocs.io/en/async/"><span class="fira-code">async</span> branch of discord.py</a>, - which is currently the stable version but is heavily outdated - </td> - </tr> - <tr> - <td class="fira-code">#discord-py-rewrite</td> - <td> - Discussion and questions relating to the - <a href="https://github.com/Rapptz/discord.py">discord.py</a> library for writing - Discord bots in Python - This channel refers specifically to the - <a href="https://discordpy.readthedocs.io/en/rewrite/"><span class="fira-code">rewrite</span> branch of discord.py</a>, - which is the most up-to-date version but is considered to be in beta - </td> - </tr> - <tr> - <td class="fira-code">#security</td> - <td> - Discussion and questions relating to cybersecurity, especially in relation to Python - and best practises - </td> - </tr> - <tr> - <td class="fira-code">#software-testing</td> - <td> - Discussion and questions relating to testing your Python applications - </td> - </tr> - <tr> - <td class="fira-code">#user-interface</td> - <td> - Discussion and questions relating to designing and building user interfaces - in Python, and related libraries and tools - this includes graphical interfaces and - console interfaces - </td> - </tr> - <tr> - <td class="fira-code">#web-development</td> - <td> - Discussion and questions relating to web development - including Python frameworks - such as Flask and Django, as well as HTML and JavaScript where it relates to the Web - </td> - </tr> - </tbody> - </table> - - <h2>Events</h2> - - <p> - Channels in this section are strictly on-topic, and designated for the discussion of Python-related - events - for example, our <a href="{{ url_for("main.jams.index") }}">Code Jams</a>, as well as any - other large, related events that many of our users are partaking in. - </p> - <p> - If you're part of a related event and you don't see a channel for it here, feel free to ask for one! - </p> - - <h2>Special</h2> - - <p> - Channels in this section are designated for special uses, and don't really fit into the other - categories. - </p> - - <table uk-table class="uk-table-striped uk-table uk-table-divider table-bordered"> - <thead> - <tr> - <th>Channel</th> - <th>Info</th> - </tr> - </thead> - <tbody> - <tr> - <td class="fira-code">#bot-commands</td> - <td> - A channel specifically for making use of the bots on the server without clogging up - the other channels - </td> - </tr> - <tr> - <td class="fira-code">#checkpoint</td> - <td> - Invisible to most users after verifying themselves, this channel is where new - users verify that they accept the rules and - <a href="{{ url_for("main.about.privacy") }}">privacy policy</a> - </td> - </tr> - <tr> - <td class="fira-code">#challenges</td> - <td> - While currently not in use, this channel lists various programming challenges that - one might like to attempt during their learning efforts - we'll be replacing this - with something better later, so stay tuned! - </td> - </tr> - <tr> - <td class="fira-code">#reddit</td> - <td> - A listing channel with a live feed of posts from - <a href="https://reddit.com/r/Python">r/Python</a>, our official subreddit. - </td> - </tr> - <tr> - <td class="fira-code">#show-your-projects</td> - <td> - A listing channel for users to show off their Python-oriented projects - please note - that this is not a discussion channel, and we do not allow postings for communities - or commercial projects - and if possible, we prefer that you post a link to your - source code instead of a website - </td> - </tr> - <tr> - <td class="fira-code">#show-your-projects-discussion</td> - <td> - Strictly on-topic discussion relating to projects posted in - <span class="fira-code">#show-your-projects</span> - we prefer that all discussion - relating to personal projects goes here - </td> - </tr> - </tbody> - </table> - - <h2>Voice</h2> - - <p> - This section contains all of our general voice channels, as well as a single text channel - - <span class="fira-code">#voice-chat</span>. If you're in a voice channel but can't use a - microphone, you should use this channel to reply to other users using text instead of any - of the other channels. - </p> - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/main/about/index.html b/templates/main/about/index.html deleted file mode 100644 index 35fe6ae0..00000000 --- a/templates/main/about/index.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}About{% endblock %} -{% block og_title %}About{% endblock %} -{% block og_description %}Partners links, and information about the server{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - About - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Learn about the server, find links to our partners, and more! - </p> - <p> - <strong>Channels</strong> - <a href="{{ url_for('main.about.channels') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">Server channel listings and information</span> - </p> - <p> - <strong>Partners</strong> - <a href="{{ url_for('main.about.partners') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">Links to our partnered servers</span> - </p> - <p> - <strong>Rules</strong> - <a href="{{ url_for('main.about.rules') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">Rules and infraction information for our community</span> - </p> - </article> - </div> - </div> -{% endblock %} diff --git a/templates/main/about/partners.html b/templates/main/about/partners.html deleted file mode 100644 index 83803265..00000000 --- a/templates/main/about/partners.html +++ /dev/null @@ -1,46 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Partners{% endblock %} -{% block og_title %}Partners{% endblock %} -{% block og_description %}List and Links to Partner servers{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Partners - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <div class="uk-column-1-2@m uk-column-divider" id="partner-cards"> - {% if partners is none %} - <div class="uk-alert-danger" uk-alert> - <p> - We were unable to load the <code>partners.json</code> file. If you see this, please - notify us! - </p> - </div> - {% else %} - {% for partner_name, partner_data in partners.items() %} - <div class="uk-card-default uk-card-hover uk-inline"> - <div class="uk-card-media-top"> - <a href="{{ partner_data['invite'] }}"> - <img src="{{ partner_data['banner'] }}" alt="{{ partner_name }}"/> - </a> - </div> - <div class="uk-card-body"> - <p>{{ partner_data['description'] }}</p> - </div> - <div class="uk-card-footer"> - <a href="{{ partner_data['invite'] }}" class="uk-button uk-button-text"> - Join the server - </a> - </div> - </div> - {% endfor %} - {% endif %} - </div> - </article> - </div> - </div> -{% endblock %} diff --git a/templates/main/about/privacy.html b/templates/main/about/privacy.html deleted file mode 100644 index fa4e2aab..00000000 --- a/templates/main/about/privacy.html +++ /dev/null @@ -1,324 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Privacy{% endblock %} -{% block og_title %}Privacy{% endblock %} -{% block og_description %}Our privacy policy, and compliance information{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Privacy - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Stay safe out there - </p> - - <p> - We take every step to ensure that your data is used ethically and that includes making sure that - you know exactly what data we collect, and what we do with it. That means that instead of a - bunch of legalese, we've provided this information in an easy, human-readable form below. - </p> - - <p> - Please note that we are a completely non-profit community. We have no interest in selling your - data, or shipping it off to third parties. Our community is entirely volunteer-run - it does - not have any form of monetary income whatsoever - and we believe that this is how it should be. - </p> - - <h3>Data collection</h3> - - <div class="uk-alert uk-alert-warning"> - <p> - Please note that data <span class="uk-text-primary">marked with blurple text below</span> is not - automatically removed. We need to hold onto this information in order to maintain infraction records - and ensure the smooth running of our community. - </p> - <p> - We do not store any data until you have verified yourself in <code>#checkpoint</code> on the server, - and certified that you agree to our rules and privacy policy. If you are leaving the server and would - like us to remove this data as well, please contact a member of staff directly. - </p> - </div> - - <table class="uk-table uk-table-divider uk-table-striped uk-table-small table-bordered" id="data-collection-table"> - <thead> - <tr class="thick-bottom-border"> - <th class="uk-width-1-4">What we collect</th> - <th class="uk-width-1-4">When it's collected</th> - <th class="uk-width-1-4">What it's used for</th> - <th class="uk-width-1-4">Who can access it</th> - </tr> - </thead> - <tbody> - <tr> - <td class="uk-text-primary">Discord user ID</td> - <td class="uk-table-shrink"><strong>!accept</strong> run on Discord</td> - <td>Statistics, data association (infractions, code jam applications, etc)</td> - <td>Administrative staff</td> - </tr> - <tr> - <td class="uk-text-primary">Discord username and discriminator</td> - <td class="uk-table-shrink"><strong>!accept</strong> run on Discord</td> - <td>Display purposes (alongside ID in staff areas, public profiles)</td> - <td>Public (for code jam team listings and winner info) and staff areas</td> - </tr> - <tr> - <td class="uk-text-primary">Discord avatar URLs</td> - <td class="uk-table-shrink"><strong>!accept</strong> run on Discord</td> - <td>Display purposes (alongside ID in staff areas, public profiles)</td> - <td>Public (for code jam team listings and winner info) and staff areas</td> - </tr> - <tr> - <td class="uk-text-primary">Assigned roles on Discord</td> - <td class="uk-table-shrink"><strong>!accept</strong> run on Discord</td> - <td>Access control for the site, infractions, role restoration after kicks</td> - <td>Administrative staff</td> - </tr> - <tr class="thick-bottom-border"> - <td class="uk-text-primary">Messages sent on Discord</td> - <td class="uk-table-shrink"><strong>!accept</strong> run on Discord</td> - <td> - Stored in memory by the bot for processing temporarily, may also end up in - staff-only logging channels for the purposes of accountability and infraction - management - </td> - <td>Administrative staff</td> - </tr> - - <tr class="thick-bottom-border"> - <td>OAuth access and refresh token</td> - <td class="uk-table-shrink">Discord login on site</td> - <td>Used to find your Discord user ID when you log in</td> - <td>Administrative staff</td> - </tr> - - <tr> - <td>GitLab username</td> - <td class="uk-table-shrink">Code jam profile</td> - <td>Used to identify you on GitLab as part of a code jam team</td> - <td>Public, for code jam team listings</td> - </tr> - <tr class="thick-bottom-border"> - <td>Timezone</td> - <td class="uk-table-shrink">Code jam profile</td> - <td>A factor in code jam team match-ups</td> - <td>Administrative staff</td> - </tr> - - <tr class="thick-bottom-border"> - <td>System Information</td> - <td class="uk-table-shrink">Code jam signup</td> - <td>Used to verify that you have a working environment</td> - <td>Administrative staff</td> - </tr> - - <tr> - <td>Email Address</td> - <td class="uk-table-shrink">Issues emailed directly to GitLab</td> - <td>Used to keep track of issue submissions</td> - <td>GitLab staff - never stored in our database</td> - </tr> - </tbody> - </table> - - <p> - Note that we don't ordinarily collect your email address, and your email address will never be - stored on our servers. The only time it will be shown is in the title of any issues you create on - GitLab by directly emailing us on the <code>meta@</code> email address. These issues are confidential, - not associated with a user account, do not require a GitLab account, and will only ever be seen by - staff. - </p> - - <h1 class="uk-article-title hover-title" id="consent"> - Collecting consent - - <a href="#consent" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - - <p> - If you joined the community on or before the <strong>20th of May, 2018</strong>, you will have seen an announcement about our - privacy policy on the Discord server. You will have had the opportunity to leave the server if - you weren't happy with it. If you decided to stay, then we will consider you to have accepted - our use of your data, as detailed on this page. - </p> - <p> - If you joined the community after the <strong>20th of May, 2018</strong>, you will have been greeted with the - <code>#checkpoint</code> channel. In this channel, you must run the <code>!accept</code> - command to signify that you accept both our rules and this privacy policy. This will also have been - detailed in a message in that channel. - </p> - <p> - Please note that your acceptance of this privacy policy is retroactive, and you agree that any - revisions to it will apply when they are published. We will attempt to keep everyone updated on - changes to this policy via the usual announcement channels - if at any point you are not happy with - a change to the privacy policy, please bring it up with a member of staff. If we're unable to - solve your issue in a satisfactory way, you may remove your data as detailed below. - </p> - - <h1 class="uk-article-title hover-title" id="removal"> - Data removal - - <a href="#removal" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - - <p> - If you'd like to remove your data from our servers, there are two options available to you. - </p> - - <div class="uk-grid uk-grid-match" uk-grid> - <div class="uk-width-3-5@m"> - <div class="uk-card uk-card-default uk-card-small"> - <div class="uk-card-header"> - <h3 class="uk-card-title">Complete data removal</h3> - </div> - - <div class="uk-card-body"> - <p> - If you'd like to remove all of your personal data from our servers, all you need to do - is leave the Discord server. As much of the data we collect is necessary for running - our community, we are unable to offer you community membership with zero data collection. - </p> - <p> - Please note that data <span class="uk-text-primary">marked with blurple text in the table above</span> - is not automatically removed. We need to hold onto this information in order to maintain infraction records - and ensure the smooth running of our community. If you are leaving the server and would like us to remove - this data as well, please contact a member of staff directly. - </p> - <p> - Once you've left the Discord server, your data is removed automatically. Please note that - for the sake of data integrity and moderation purposes, we do not remove your Discord - user ID from our database - but we do anonymize your data as far as possible. - </p> - <p> - As with deleting your code jam profile directly, you will be issued an automatic ban - from future code jams if you have applied for or are currently taking part in a - code jam. - </p> - </div> - </div> - </div> - <div class="uk-width-2-5@m"> - <div class="uk-card uk-card-default uk-card-small"> - <div class="uk-card-header"> - <h3 class="uk-card-title">Code jam profile removal</h3> - </div> - - <div class="uk-card-body"> - <p> - If you've provided us with a code jam profile in the past and would like to remove - it, you may do so by heading to the - <a href="{{ url_for("main.jams.profile") }}">"My Profile" page</a>, - where you will find a button that will remove your profile. - </p> - <p> - Please note that this is a nuclear option. If you have applied for or are currently - taking part in a code jam, this will void your application and you will receive an - automatic ban from future code jams until you've contacted us about it. - </p> - </div> - </div> - </div> - </div> - - <h1 class="uk-article-title hover-title" id="gdpr"> - GDPR compliance - - <a href="#gdpr" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Keeping your data under your control - </p> - - <p> - Under the terms specified above, we do aim to comply with GDPR. While we do not currently have - an automated way for users to export the data they've provided to us, we're happy to do this - manually or answer any other GDPR- or privacy-related queries you may have. Feel free to contact - our GDPR officer on Discord (<code>gdude#2002</code>), or any other member of the administrative - staff. - </p> - <p> - We believe that the best way to keep your personal data safe is to avoid collecting it at all. - Discord itself is GDPR-compliant and they've already done the legwork required to ensure that - your data may be collected - so we don't see the need to collect your personal information - ourselves. Don't forget that by using Discord, you are stating that you are of legal age in - your country to give consent to process your data! - </p> - <p> - We are currently working on an automated way to get all of your data in both a human-readable - and machine-readable format. Keep your eye on the usual announcements channels for more information - on that, as it happens. - </p> - - <h1 class="uk-article-title hover-title" id="changelog"> - Changelog - - <a href="#changelog" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Accountability, for the masses - </p> - - <ul class="uk-list uk-list-divider"> - <li> - <h4>July 27th, 2018</h4> - <p> - As we're replacing Rowboat (the bot we use for moderation), we need to hold onto some of - your data - even after you've left the server. This is necessary to ensure the smooth - running and security of our community. - </p> - </li> - <li> - <h4>July 3rd, 2018</h4> - <p> - While we don't collect your email addresses, they are visible on GitLab if you email an - issue directly to our <code>meta@</code> email address, but only to staff. - </p> - </li> - <li> - <h4>June 7th, 2018</h4> - <p> - We no longer collect GitHub usernames - instead, we collect GitLab usernames. Additionally, - we now collect user avatar URLs for display purposes. - </p> - </li> - <li> - <h4>June 5th, 2018</h4> - <p> - Rectified an omission in the old privacy policy, where the system information you provide - as part of a code jam signup wasn't mentioned. - </p> - </li> - <li> - <h4>May 31st, 2018</h4> - <p> - We no longer collect your date of birth, and all collected dates of birth have been - removed from our database. The reason for this is that Discord itself already complies with - GDPR - and in order for you to sign up for a code jam, you must already have a Discord - account. - </p> - </li> - <li> - <h4>May 20th, 2018</h4> - <p> - Completed the first version of our privacy policy. We also updated our OAuth scopes for - Discord logins - we no longer collect your email, or get the access to join you to servers - automatically. All collected emails have also been removed from the database. - </p> - </li> - </ul> - </article> - </div> - </div> -{% endblock %} diff --git a/templates/main/about/rules.html b/templates/main/about/rules.html deleted file mode 100644 index b11f91d9..00000000 --- a/templates/main/about/rules.html +++ /dev/null @@ -1,124 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Rules{% endblock %} -{% block og_title %}Rules{% endblock %} -{% block og_description %}The server rules, along with an explanation of what happens when they're broken{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Rules - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Keeping our noses clean since 2017 - </p> - <p> - We have a small but strict set of rules on our server. Please read over them and take them on board - - if you don't understand anything or need some clarification, feel free to ask any staff member! - </p> - <ol> - <li> - Be polite, and do not spam - </li> - <li> - Follow the <a href="https://discordapp.com/guidelines">Discord community guidelines</a> - </li> - <li> - Don't intentionally make other people uncomfortable - if someone asks you to stop discussing - something, you should stop - </li> - <li> - Be patient both with users asking questions, and the users answering them - </li> - <li> - We will not help you with anything that might break a law or the terms of service of any other - community, site, service, or otherwise - No piracy, brute-forcing, captcha circumvention, - sneaker bots, or anything else of that nature - </li> - <li> - Listen to and respect the staff members - we're here to help, but we're all human beings - </li> - <li> - All discussion should be kept within the relevant channels for the subject - See the - <a href="{{ url_for("main.about.channels") }}">channels page</a> for more information - </li> - <li> - This is an English-speaking server, so please speak English to the best of your ability - - <a href="https://translate.google.com">Google Translate</a> should be fine if you're not sure - </li> - <li> - Keep all discussions safe for work - No gore, nudity, sexual soliciting, references to suicide, - or anything else of that nature - </li> - <li> - We do not allow advertisements for communities or commercial projects - Contact us directly if - you want to discuss a partnership! - </li> - </ol> - - <h1 class="uk-article-title hover-title" id="nickname-policy"> - Nickname Policy - - <a href="#nickname-policy" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Keep It Simple, Stupid - </p> - <p> - In order to keep things pleasant and workable for both users and staff members, we enforce the - following requirements regarding your nickname. - </p> - <ol> - <li>No blank or "invisible" names</li> - <li>No slurs or other offensive sentiments</li> - <li>No noisy unicode characters - for example, z̯̯͡a̧͎̺̻̝͕̠l̡͓̫̣g̹̲o̡̼̘ or byte order marks</li> - <li>No nicknames designed to annoy other users</li> - <li>Make sure the nickname is easy to mention using a keyboard that can only type ASCII characters</li> - </ol> - <p> - Staff reserves the right to change the nickname of any user for any reason. Failure to comply with these - requirements may result in you losing the right to change your nickname. We also reserve the right to - discipline users with offensive usernames, regardless of the nickname they're using. - </p> - - <h1 class="uk-article-title hover-title" id="infractions"> - Infractions - - <a href="#infractions" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Why you gotta be so rude? - </p> - <p> - We have a generally no-nonsense policy when it comes to our rules. If you notice someone breaking - them, feel free to mention or DM a staff member and we'll try to deal with it as soon as possible. - </p> - <p> - The possible actions we take based on infractions can include the following: - </p> - <ul> - <li>A public verbal or textual warning</li> - <li>Forced nick changes, where appropriate</li> - <li>A short temporary mute</li> - <li>A long temporary mute</li> - <li>A kick from the server</li> - <li>A temporary ban from the server</li> - <li>A permanent ban from the server</li> - </ul> - <p> - While we do discuss more serious matters internally before handing out a punishment, simpler - infractions are dealt with directly by individual staffers and the punishment they hand out is left - to their own discretion. - </p> - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/main/base.html b/templates/main/base.html deleted file mode 100644 index bb12fc9b..00000000 --- a/templates/main/base.html +++ /dev/null @@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - {% block head %} - <title>Python Discord | {% block title %}{% endblock %}</title> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <script src="{{ static_file('js/script.js') }}" type="application/javascript"></script> - - <!-- Stylesheets --> - <link rel="shortcut icon" href="{{ static_file('favicon.ico') }}"> - <link rel="stylesheet" href="{{ static_file('css/uikit_blurple.css') }}"/> - <link rel="stylesheet" href="{{ static_file('css/style.css') }}"/> - <link rel="stylesheet" href="{{ static_file('css/bundled/pygments-monokai.css') }}"/> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> - - <!-- OpenGraph metadata --> - <meta property="og:title" content="Python Discord | {% block og_title %}{% endblock %}"> - <meta property="og:description" content="{% block og_description %}We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.{% endblock %}"> - <meta content="/static/logos/logo_discord.png" property="og:image"> - {% endblock %} - {% block extra_head %} - - {% endblock %} - </head> - <body class="{% block page_classes %}{% endblock page_classes %} - page-{{ current_page.replace(".", "-") }} - blueprint-{{ blueprint.replace(".", "-") }}"> - {% if current_page == "main.index" %} - <div class="uk-offcanvas-content uk-section-primary"> - {% else %} - <div class="uk-offcanvas-content"> - {% endif %} - {% include "main/navigation.html" %} - {% block content %}{% endblock %} - </div> - - <footer> - <div class="uk-section uk-section-secondary uk-container-medium uk-text-meta"> - <div class="uk-text-center uk-text-meta"> - <p> - This website uses <a href="https://python.org">Python</a> and - <a href="http://flask.pocoo.org/">Flask</a>, and was developed collaboratively on - <a href="https://gitlab.com/python-discord/projects/site">GitLab</a>. - <br /> - For privacy & GDPR-related info, please <a href="{{ url_for("main.about.privacy") }}">see this page</a>. - </p> - </div> - </div> - </footer> - </body> -</html> diff --git a/templates/main/bot/clean_logs.html b/templates/main/bot/clean_logs.html deleted file mode 100644 index 83ee0cba..00000000 --- a/templates/main/bot/clean_logs.html +++ /dev/null @@ -1,81 +0,0 @@ -<html class="clean-logs"> - <head> - <link rel="stylesheet" href="{{ static_file('css/style.css') }}"/> - </head> - <body> - {% for message in messages %} - - <!-- Main message --> - <span class="nick" style="color: {{ message.color }}">{{ message.author }}<span class="time">{{ message.timestamp }} | User ID: {{ message.user_id }}</span></span><br> - <span class="text">{{ message.content }}</span> - - <!-- File attachments --> - {% for attachment in message.attachments %} - <span class="text">{{ attachment }}</span> - {% endfor %} - - <!-- Embeds --> - {% for embed in message.embeds %} - <div class="embed"> - - <!-- Title --> - {% if embed.title %} - {% if embed.url %} - <span><strong><a href="{{ embed.url }}">{{ embed.title }}</a></strong></span><br> - {% else %} - <span><strong>{{ embed.title }}</strong></span><br> - {% endif %} - {% endif %} - - - <!-- Description --> - {% if embed.description %} - <br> - <span>{{ embed.description }}</span> - {% endif %} - - <!-- Fields --> - {% if embed.fields %} - <div class="fields"> - {% for field in embed.fields %} - <div class="field"> - <br> - {% if field.name %} - <span><strong>{{ field.name }}</strong></span><br> - {% endif %} - - <span>{{ field.value }}</span> - </div> - {% endfor %} - </div> - {% endif %} - - <!-- Image --> - {% if embed.image %} - <br> - {% if embed.image.url %} - <img src="{{ embed.image.url }}"> - {% endif %} - {% endif %} - - <!-- Thumbnail --> - {% if embed.thumbnail %} - <br> - {% if embed.thumbnail.url %} - <img src="{{ embed.thumbnail.url }}"> - {% endif %} - {% endif %} - - <!-- Footer --> - {% if embed.footer %} - <br> - {% if embed.footer.text %} - <span class="footer">{{ embed.footer.text }}</span> - {% endif %} - {% endif %} - </div> - {% endfor %} - {% endfor %} - </body> -</html> - diff --git a/templates/main/index.html b/templates/main/index.html deleted file mode 100644 index c73c2e4b..00000000 --- a/templates/main/index.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Home{% endblock %} -{% block og_title %}Home{% endblock %} -{% block content %} -<div class="uk-section uk-section-primary"> - <div class="uk-container uk-text-center"> - <h1 class="uk-header uk-article-title"> - Python Discord - </h1> - <p class="uk-article-meta"> - The official Discord server of <a href="https://www.reddit.com/r/Python/">r/Python</a> - </p> - <p class="uk-text-lead"> - We're a large, friendly community focused around the Python programming language, - open to those who wish to learn the language or improve their skills, as well as - those looking to help others. - </p> - <p> - We organise regular community events and have a dedicated staff of talented Python developers - available to assist around the clock. Whether you're looking to learn the language or working - on a complex project, we've got someone who can help you if you get stuck. - </p> - <div class="uk-container uk-align-center"> - <a href="{{ url_for('main.invite') }}" class="uk-button uk-button-large uk-button-darkish" id="invite-button"> - <img src="https://discordapp.com/api/guilds/267624335836053506/embed.png?style=banner3"> - </a> - </div> - <hr class="uk-divider-icon"/> - <div class="uk-container uk-container-small uk-text-meta"> - <p> - Please note: this site is under construction. What you see now may be vastly different - from the final project state. Feel free to chat to us on Discord if you're curious! - </p> - </div> - - </div> -</div> -{% endblock %} diff --git a/templates/main/info/faq.html b/templates/main/info/faq.html deleted file mode 100644 index e742f317..00000000 --- a/templates/main/info/faq.html +++ /dev/null @@ -1,324 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}FAQ{% endblock %} -{% block og_title %}FAQ{% endblock %} -{% block og_description %}Frequently Asked Questions{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Frequently Asked Questions - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Insert witty quip here - </p> - <p> - These are some of the most-asked questions we get on a day-to-day basis. If you have a - question, be sure to check this page and see if we've answered it already. If you'd like to - suggest an entry to this page, why not submit a merge request - <a href="https://gitlab.com/python-discord/projects/site">on GitLab</a>? - </p> - - <div uk-grid class="uk-grid uk-grid-match"> - <div class="uk-width-1-1@s"> - <h2 class="uk-heading-divider" id="starting-out"> - Starting Out with Python - - <a href="#starting-out" class="uk-text-primary uk-float-right" title="Permanent link to this header"> - <i class="far fa-link"></i> - </a> - </h2> - </div> - - <div class="uk-width-1-3@m"> - <strong>Is Python a good first language?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - In our opinion, yes it is. It's a very powerful language, but it will force you to - write readable code and it's designed to allow you to write code very quickly, without - you having to keep your head in a book for hours on end. - </p> - <p> - Python is used as a teaching language in many schools, colleges and universities - but - it's a very capable language that is suitable for many real-world tasks as well, and - it's only gaining in popularity! - </p> - </div> - - <div class="uk-width-1-3@m"> - <strong>I'm new to Python - how/where do I get started?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - How you get started with Python is very much going to depend on your prior programming - experience. If you're already an experienced programmer, you should should have no - trouble following pretty much any guide out there - but for true beginners, we recommend - full-on tutorials such as Automate the Boring Stuff with Python. - </p> - <p> - For more information on that and other resources, feel free to take a look at - <a href="{{ url_for("main.info.resources") }}">our resources page</a>. - </p> - </div> - - <div class="uk-width-1-3@m"> - <strong>Should I start with Python 2 or Python 3? Which is better?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - Generally, we're always going to recommend that people new to Python start with Python 3. - There's a few reasons for this: - </p> - <ul> - <li> - Python 3 is the latest-and-greatest version. It gets all the new features and is in - active development. - </li> - <li> - Python 2 lacks many features available in Python 3 and is mechanically different in a - few important areas. - </li> - <li> - Python 2 is being sunset and will reach its end of life in 2020. It will not be - maintained past 2020. There will be no Python 2.8. - </li> - <li> - Most libraries now fully support Python 3, and many are dropping or have dropped support - for Python 2. - </li> - </ul> - - <p> - The only reason a user may want to stick with Python 2 is if they are stuck working a job - with a legacy codebase that cannot or will not be updated to work with Python 3. To users - in those situations: Commiserations. - </p> - </div> - - <div class="uk-width-1-3@m"> - <strong>What IDE/Editor should I use? Should I use an IDE if I'm a beginner?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - If you're a beginner, you should not be using an IDE. This is because IDEs do a lot of - basic things automatically where a beginner should learn to do things themselves - for - example, some IDEs can generate huge chunks of code or catch beginner errors without you - even noticing you'd made a typo. - </p> - <p> - If you're not a beginner or you decide to try an IDE regardless, we heavily recommend - <a href="https://www.jetbrains.com/pycharm/">PyCharm</a>. This is a well-known IDE which - is entirely in a league of its own, and has a very capable free "community" edition that - will serve most people's needs. - </p> - <p> - We've listed off some of our favourite editors and IDEs on - <a href="{{ url_for("main.info.resources") }}">our resources page</a>. Feel free to - take a look if you're not sure what's out there. - </p> - <p> - By the way, we host <a href="{{ url_for("main.jams.index") }}">quarterly code jams</a> - for the users of our community, and the prize for winning it is a one-year PyCharm Pro - license - sponsored by JetBrains. If you like PyCharm and are thinking of grabbing a copy - of Pro, why not join in? - </p> - </div> - - <div class="uk-width-1-3@m"> - <strong>What's wrong with "Learn Python the Hard Way"?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - Learn Python the Hard Way, Zed Shaw's most infamous work, is largely considered by the - Python community to be poor-quality and misleading in general. This is due to numerous - issues with the material, which include being extremely opinionated and sometimes - condescending, out of date, confusing and even wildly incorrect in some places. - </p> - <p> - Learners that have used Learn Python the Hard Way as their primary learning material often - find themselves confused and asking questions that really don't make that much sense - it's - also been observed that learners in this position tend to suffer heavily from the infamous - <a href="http://xyproblem.info/">XY Problem</a>. - </p> - <p> - For more information on why you should avoid Learn Python the Hard Way, you can have a look - at <a href="https://sopython.com/wiki/LPTHW_Complaints">this article on the sopython - wiki</a>, - which enumerates the most egregious issues with it. - </p> - </div> - - <div class="uk-width-1-3@m"> - <strong>If I type "python" or "pip" into a terminal, I get "command not found".</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - That's not a question, but there's a few things you can look at to try to solve this. - </p> - <ul> - <li> - If you're on Windows, the python installer has an option labelled "Add to PATH" - - Make sure you check this when you install python. If you forgot to do that the - first time, then the easiest way to solve this problem is to reinstall Python - </li> - <li> - If you're on Windows, there's a good chance that <code>python</code> and - <code>pip</code> aren't what you actually need to run! Some options you could - try include <code>py -3</code>, <code>python3</code> or <code>python36</code> - if - one of these works, then you should be able to use <code>py -3 -m pip</code>, - <code>pip3</code> or <code>pip36</code> as well - </li> - <li> - If you're on a Mac, Python comes with the OS - however, it's quite likely to be - an old version. You can solve this by using <a href="https://brew.sh">Homebrew</a> - to install a more recent version of Python, which should be made available as - <code>python3</code> - </li> - </ul> - </div> - - <div class="uk-width-1-3@m"> - <strong>Why can't I import this module?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - When finding yourself unable to import something in Python, you can follow these - steps to figure it out: - </p> - <ul> - <li> - Is the module part of <a href="https://docs.python.org/3/library/">Python's standard - library</a>? - </li> - <li> - If not, have you installed it? If the module <a href="https://pypi.org/search/">is on - PyPi</a>, - you can install it using pip in a terminal: <code>pip install module_name</code> - </li> - <li> - If you think you've installed it, try upgrading it with pip in a terminal: - <code>pip install -U module_name</code> - Make sure there were no errors during - installation - </li> - <li> - If all else fails, make sure you've read the module documentation fully, and ensure - that you're following it correctly - </li> - <li> - If you're sure that you've done everything correctly, you may have found a bug - come - and chat to us, and we might recommend that you report your problem to the developer - </li> - </ul> - </div> - - <div class="uk-width-1-3@m"> - <strong>What's PEP8? Should I care about code style?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - <a href="https://www.python.org/dev/peps/pep-0008/">Python Enhancement Proposal #8</a> - is known as the official Python style guide. It sets out a lot of very clear guidelines - which help you structure your code. - </p> - <p> - One of the most useful things you can do when writing your code is to follow a style - guide. It makes it easier to read your code overall, but a consistent style guide - is very important as it means that everyone that contributes to your project is - writing code in the same style - meaning everyone will be able to read it. As PEP - itself reads: "A foolish consistency is the hobgoblin of little minds". - </p> - <p> - PEP8 isn't the only style guide available to you, but it is the most widely used - and best-understood of them - and for that reason, we do recommend you use it. That - said, - <a href="https://google.github.io/styleguide/pyguide.html">Google's Python Style Guide</a> - is also widely used by Google engineers. - </p> - </div> - - <div class="uk-width-1-1@s"> - <h2 class="uk-heading-divider" id="community"> - Community Questions - - <a href="#community" class="uk-text-primary uk-float-right" title="Permanent link to this header"> - <i class="far fa-link"></i> - </a> - </h2> - </div> - - <div class="uk-width-1-3@m"> - <strong>Why did you move to GitLab? Do you hate Microsoft?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - While many of our users do prefer to work on Linux, we don't hate Microsoft. While - <a href="https://www.theregister.co.uk/2018/06/04/microsoft_buys_github/"> - the news about Microsoft's acquisition of GitHub - </a> - did prompt us to initially mirror our GitHub repositories to GitLab for safety, we didn't - outright make the move because of the acquisition - in fact, some of our staff members - had been suggesting we use it from the start! Here's some of the reasons we decided - to move: - </p> - <ul> - <li> - Prior to moving to GitLab, our development efforts were split among three services: - <a href="https://clickup.com/">ClickUp</a> for issue tracking, - <a href="https://github.com/">GitHub</a> for code storage and collaboration, - and <a href="https://clickup.com/">Travis</a> for continuous integration and testing. - GitLab is a fantastic alternative to all of these services, and moving to it has allowed - us to consolidate our efforts in one place. - </li> - <li> - For a long time now, GitLab has been innovating on features and pushing them to production - much faster than GitHub. Using GitLab gives us far more options when it comes to issue - management, merge requests, continuous integration and deployment - to name - a few things. - </li> - <li> - In the vast majority of cases where GitHub and GitLab solve the same problem or - have a similar feature, GitLab does it better. - </li> - <li> - GitLab has had free private repositories for some time now, and these are convenient - for us to store internal documentation and tasks in. - </li> - <li> - GitLab is fully open-source and quite easy to host yourself. In the event that the - public platform ends up dying or being abused by its staff, we can simply spin - up our own instance and keep on working as if there were no problems. - </li> - </ul> - </div> - - <div class="uk-width-1-1@s"> - <h2 class="uk-heading-divider" id="misc"> - Misc. Questions - - <a href="#misc" class="uk-text-primary uk-float-right" title="Permanent link to this header"> - <i class="far fa-link"></i> - </a> - </h2> - </div> - - <div class="uk-width-1-3@m"> - <strong>What does "real" Python development look like?</strong> - </div> - <div class="uk-width-2-3@m"> - <p> - Python is a very versatile language, and a real-life application using it can take - many forms. That said, we do plenty of Python development here ourselves. If - you're curious about this question, then why not take a look at - <a href="https://gitlab.com/python-discord">our projects</a>? - </p> - </div> - </div> - </article> - </div> - </div> -{% endblock %} diff --git a/templates/main/info/help.html b/templates/main/info/help.html deleted file mode 100644 index 9cc09af2..00000000 --- a/templates/main/info/help.html +++ /dev/null @@ -1,461 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Getting Help{% endblock %} -{% block og_title %}Getting Help{% endblock %} -{% block og_description %}A guide on how to ask good questions, how to avoid annoying those helping out, and how to interpret answers{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Getting Help - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Everything's exploding, customers are complaining, management's on the fritz! - </p> - <p> - This document is intended to provide you with the information you need to get help as quickly and - effectively as possible. If you're stuck on a problem or you just don't understand something, feel - free to join us and ask for help - you can use this as a reference when forming your question. - </p> - <p> - Much of this document is based on the sentiments expressed by Eric Steven Raymond and Rick Moen - in their essay, <a href="http://www.catb.org/esr/faqs/smart-questions.html">How To Ask Questions The Smart Way</a>. - Please note that the essay is very long and may be considered rude by some. Additionally, the people - behind that essay are in no way affiliated with us - please do not bother them with your Python - problems. - </p> - <h2 class="uk-article-title hover-title" id="before"> - Before You Ask - - <a href="#before" 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"> - Take stock of your problem, and do your homework. - </p> - <p> - Before you ask your question, there are a few things you can do to find an answer on your own. - Experienced developers will do the following: - </p> - <ul> - <li>Read the official documentation for whatever you're working with</li> - <li>Use a debugger to inspect your code</li> - <li>Do some research online - for example, on Stack Overflow</li> - <li>Read the source code for whatever you're working with</li> - <li>Search the message history of the help channels</li> - </ul> - <p> - Essentially, doing your research is the first step towards a solution to any problem. If your - problem isn't extremely general, we're going to be doing exactly these steps ourselves when you ask, - so doing the legwork beforehand saves everyone a lot of time. - </p> - </article> - </div> - </div> - <div class="uk-section uk-section-muted"> - <div class="uk-container uk-container-small uk-text-center"> - <blockquote> - <p> - <i class="fas fa-quote-left fa-pull-left"></i> - <i class="fas fa-quote-right fa-pull-right"></i> - Creativity requires input, and that's what research is. You're gathering material with which to - build. - </p> - <small> - Gene Luen Yang - </small> - </blockquote> - </div> - </div> - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <p> - If you're an absolute beginner, take a moment to step back from the problem. - Have you <a href="https://wiki.python.org/moin/BeginnersGuide/NonProgrammers">read a book or done a - tutorial</a>? There's a huge amount of resources out there, many of which are going to help you a lot more than - us answering the beginners' questions for you. If you're following a tutorial, book or course and - you don't understand something, then <strong>that</strong> is the correct time to ask a beginners' - question. Of course, we won't turn you away if you do have a beginners' question — by all - means, - come to us if you do have a problem. - </p> - <p> - Have you read the official documentation for the module or technology you're working with? The - <a href="https://docs.python.org/3/">official Python 3 docs</a> are a fantastic and valuable - resource, so if you're using a bundled module, your first port of call should be there. If you're - using a third-party library, often they will have some official documentation uploaded somewhere - — - try having a Google around, or take a look <a href="https://pypi.org">at PyPi</a> in case they've - linked it from there. - </p> - <p> - If you can't find the documentation or you find it lacking, the next place to look is the source - code. - Grab a decent IDE (we recommend <a href="https://www.jetbrains.com/pycharm/">PyCharm</a> Community) - and a coffee, download a copy of the project and open it up, and get to browsing! - </p> - <p> - If you're still confused, try searching the Internet for people that have already had the same - problem. Often, you won't be the only person to have encountered the issue you're dealing with - more often - than not, you'll find a GitLab ticket or a StackOverflow question along with a fix or answer to your - question already posted. - </p> - <p> - If none of the above helps you or you're lost, scared and alone, feel free to continue on to the - Discord server. You can use the search feature (the <i class="fas fa-search"></i> at the top right) to check - whether someone else has asked your question recently, or just feel free to pick one of the help channels - and ask your question. - </p> - <h2 class="uk-article-title hover-title" id="good-question"> - A Good Question - - <a href="#good-question" 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"> - Thank you for helping us help you help us all. - </p> - <p> - When you're ready to ask a question, there's a few things you should have to hand before forming - a query. - </p> - <ul> - <li> - A code example that illustrates your problem - <ul> - <li>If possible, make this a minimal example rather than an entire application</li> - </ul> - </li> - <li>Details on how you attempted to solve the problem on your own</li> - <li>Full version information — for example, <em class="uk-text-primary">"Python 3.6.4 with - discord.py 1.0.0a"</em></li> - </ul> - <p> - Your question should be informative, but to the point. More importantly, how you phrase your - question - and how you address those that may help you is crucial. Courtesy never hurts, and please type - using correctly-spelled and grammatical language as far as you possibly can. - </p> - <p> - When you're inspecting a problem, don't be quick to assume that you've found a bug, or that your - approach is correct. While it helps to detail what exactly you're trying to do, you should also - be able to give us the bigger picture - describe the goal, not just the step. Describe the problem's - symptoms in chronological order - not your guesses as to their cause. - </p> - </article> - </div> - </div> - <div class="uk-section uk-section-muted"> - <div class="uk-container uk-container-small uk-text-center"> - <div class="uk-child-width-expand" uk-grid> - <div class="uk-text-primary"> - <p class="uk-text-bold uk-text-center"> - Bad Questions - </p> - </div> - <div class="uk-text-primary"> - <p class="uk-text-bold uk-text-center"> - Good Questions - </p> - </div> - </div> - <div class="uk-grid-divider uk-child-width-expand" uk-grid> - <div class="uk-text-danger"> - <p> - Where can I find information on discord.py? - </p> - <p class="uk-text-meta"> - This question suggests that the person asking it hasn't done any research, or even a simple - Google search. - </p> - </div> - <div class="uk-text-success"> - <p> - I used Google to try to find more information about "discord.py 1.0.0a", but I couldn't - really - find anything useful. Does anyone know where I might find a guide to writing commands - using this library? - </p> - </div> - </div> - <div class="uk-child-width-expand" uk-grid> - <div> - <hr class="uk-divider-icon"/> - </div> - <div> - <hr class="uk-divider-icon"/> - </div> - </div> - <div class="uk-grid-divider uk-child-width-expand" uk-grid> - <div class="uk-text-danger"> - <p> - Pillow puts my text at the bottom of the image instead of where I wanted it. Why is it broken? - </p> - <p class="uk-text-meta"> - This question assumes that the problem is with Pillow itself, and that it isn't - the questioner's fault. It also doesn't provide enough information on the problem. - </p> - </div> - <div class="uk-text-success"> - <p> - Pillow appears to insert text at the bottom of the image if the given X coordinate is negative. - I had a look at the documentation and searched Stack Overflow, but I couldn't find any - information on using negative coordinates to position text. Has anyone attempted this? - </p> - </div> - </div> - <div class="uk-child-width-expand" uk-grid> - <div> - <hr class="uk-divider-icon"/> - </div> - <div> - <hr class="uk-divider-icon"/> - </div> - </div> - <div class="uk-grid-divider uk-child-width-expand" uk-grid> - <div class="uk-text-danger"> - <p> - I'm having some trouble writing a YouTube random URL generator - can anyone help? - </p> - <p class="uk-text-meta"> - This question provides no information on the problem, and asks for help in a way that isn't - engaging - some people will find this annoying, as answering your question is guaranteed - to result in another question. - </p> - </div> - <div class="uk-text-success"> - <p> - My YouTube random URL generator appears to be returning false positives for tested URLs, - stating that a URL points to a real video when that video doesn't actually exist. Obviously - there's some issue with how this is checked, but I can't put my finger on it. Is there anything - I can check? - </p> - </div> - </div> - <div class="uk-child-width-expand" uk-grid> - <div> - <hr class="uk-divider-icon"/> - </div> - <div> - <hr class="uk-divider-icon"/> - </div> - </div> - <div class="uk-grid-divider uk-child-width-expand" uk-grid> - <div class="uk-text-danger"> - <p> - I want to share a YouTube video with my friend, but the video doesn't move when I print the page. - How do I make the video move? - </p> - <p class="uk-text-meta"> - This question assumes a specific (wrong) approach, and isn't open-ended enough to account for - the possibility of a better solution. - </p> - </div> - <div class="uk-text-success"> - <p> - I'm attempting to figure out the best way to share a YouTube video with my friend that doesn't - have the Internet at home. I can't think of a better approach than printing the page, which - obviously doesn't help much given that the video doesn't move on the paper - can anyone think - of a better approach to this? - </p> - </div> - </div> - <div class="uk-child-width-expand" uk-grid> - <div> - <hr class="uk-divider-icon"/> - </div> - <div> - <hr class="uk-divider-icon"/> - </div> - </div> - <div class="uk-grid-divider uk-child-width-expand" uk-grid> - <div class="uk-text-danger"> - <p> - I was given this assignment by my teacher, but I'm not sure how to approach it. Does anyone - have any ideas? - </p> - <p class="uk-text-meta"> - This question is clearly a homework question. Homework is supposed to challenge you, and we - will not provide solutions to homework. Instead, ask a more general question. - </p> - </div> - <div class="uk-text-success"> - <p> - I have a list of numbers - how do I calculate how many of them are even? Is there a way - to remove all the odd numbers from my list? Are there quick ways to find the average of - a list of numbers, or add them all together? - </p> - </div> - </div> - </div> - </div> - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h2 class="uk-article-title hover-title" id="answers"> - Interpreting Answers - - <a href="#answers" 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"> - Wow, rude. - </p> - <p> - Programmers have a certain set of mannerisms. While we all try to be as courteous with our replies - as possible, occasionally it may seem as if a helper is annoyed or disinterested in your question. - This isn't personal - it's just part of our culture. Remember that the people you're asking for help - are humans and that they're here voluntarily, in their free time. - </p> - <p> - If you've asked a question and you're told to read the documentation or search the web, you should - do that. When this happens, it's often the case that the person responding has the information you need - open in their web browser and either thinks that it's very easy to find, or that you would learn - more from seeking out the source of the information yourself. If you've already done this, you should - tell us by including it in your question! - </p> - <p> - If you don't understand an answer, don't immediately bounce back and demand clarification. Use the - tools available to you (the internet, documentation, source code) to help you understand the answer, and - if you still can't figure it out, ask for clarification and provide any relevant information you learned - during your research. - </p> - </article> - </div> - </div> - - <div class="uk-section uk-section-muted"> - <div class="uk-container uk-container-small uk-text-center"> - <blockquote> - <p> - <i class="fas fa-quote-left fa-pull-left"></i> - <i class="fas fa-quote-right fa-pull-right"></i> - Successful people ask better questions, and as a result, they get better answers. - </p> - <small> - Tony Robbins - </small> - </blockquote> - </div> - </div> - - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <p> - Much of what looks like rudeness within programming communities is not intended to be offensive and - it's often just a product of the down-to-earth, direct style of communication that is typical in - a community that is more concerned with solving problems than anything else. If you perceive - rudeness, try to react calmly. If a user really is acting out, then chances are that a member of staff will - call them out on it. If this doesn't happen, contact a member of staff directly and they will try - to clarify this with you. - </p> - <p> - It's okay to mess up. It happens to all of us. That said, if you mess up badly enough, it's likely - that you will be corrected there and then, in public and with a verbal scalpel. Take this as a - learning experience and don't let it get to you - this is a common and appropriate response in - many programming circles. Community standards do not maintain themselves - they're maintained by - people applying actively them, visibly, in public. - </p> - - <h2 class="uk-article-title hover-title" id="what-not-to-ask"> - What Not To Ask - - <a href="#what-not-to-ask" 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"> - Sample questions to avoid as much as possible. - </p> - - <p class="uk-text-lead"> - Can I ask a question? - </p> - <p> - Yes. Always yes. Just ask it. - </p> - - <p class="uk-text-lead"> - Can I use str() on a discord.py Channel object? - </p> - <p> - Try it yourself and see. Experimentation is a great way to learn, and you'll save a lot of time by - just trying things out. Don't be afraid of your computer! - </p> - - <p class="uk-text-lead"> - My code doesn't work - </p> - <p> - This isn't a question, and it provides absolutely no context or information. Depending on the moods - of the people that are around, you may even find yourself ignored. Don't be offended by this - just - try - again with a better question. - </p> - </article> - </div> - </div> - - <div class="uk-section uk-section-muted"> - <div class="uk-container uk-container-small uk-text-center"> - <blockquote> - <p> - <i class="fas fa-quote-left fa-pull-left"></i> - <i class="fas fa-quote-right fa-pull-right"></i> - So much of life isn’t about having the right answer; it’s about knowing the right question. - </p> - <small> - Duane Hewitt - </small> - </blockquote> - </div> - </div> - - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <p class="uk-text-lead"> - Can anyone help me break into someone's Facebook account?<br/> - Can anyone help me download anime from this streaming site's listing page?<br/> - How do I write a virus? - </p> - <p> - We will absolutely not help you with hacking, pirating, or any other illegal activity. A question - like this is likely to be followed up with a ban if the person asking it doesn't back down quickly. - </p> - - <p class="uk-text-lead"> - Can I send you a private message? - </p> - <p> - No. We do not provide one-on-one tutoring - you can hire someone locally if you really need that. We - also prefer that questions are answered in a public channel as it means that everyone else present - is able to learn from them. If you're working with code that you are unable to disclose for any - reason, you should try to make your question more general and write a separate, small piece of code - to illustrate your problem. - </p> - - <p class="uk-text-lead"> - Can you help me over Teamviewer? - </p> - <p> - No. We will not help you by accessing your computer remotely, or watching a video stream of your - problem, unless the problem is something that inherently requires that. The reason for this is that - our time is limited, and watching a video or participating in a screen-sharing session means that we - have to focus on you, instead of being able to deal with other people while you're figuring out an - answer. If your problem is graphical and you can't adequately describe it without a visual, take a - screenshot or provide a short screen recording to illustrate your problem. - </p> - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/main/info/index.html b/templates/main/info/index.html deleted file mode 100644 index 07e1a4d8..00000000 --- a/templates/main/info/index.html +++ /dev/null @@ -1,43 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Information{% endblock %} -{% block og_title %}Information{% endblock %} -{% block og_description %}Informational pages, listings and guides{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Information - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - What you need, when you need it - </p> - - <p> - <strong>Code Jams</strong> - <a href="{{ url_for('main.info.jams') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">Information on our monthly code jams, where users are paired into teams to compete with each other</span> - </p> - - <p> - <strong>Getting Help</strong> - <a href="{{ url_for('main.info.help') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">How to ask for help - and how to interpret the responses</span> - </p> - - <p> - <strong>Resources</strong> - <a href="{{ url_for('main.info.resources') }}"><i class="fas fa-link"></i></a> - <br /> - <span class="uk-text-meta">A page full of useful resources for learning and working with Python</span> - </p> - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/main/info/resources.html b/templates/main/info/resources.html deleted file mode 100644 index 574d0bfb..00000000 --- a/templates/main/info/resources.html +++ /dev/null @@ -1,103 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Resources{% endblock %} -{% block og_title %}Resources{% endblock %} -{% block og_description %}A list of helpful resources for beginner and experienced Python programmers alike{% endblock %} -{% block content %} - <div class="uk-section"> - <div class="uk-container uk-container-small"> - <article class="uk-article"> - <h1 class="uk-article-title hover-title" id="top"> - Resources - - <a href="#top" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - </h1> - <p class="uk-article-meta"> - Learn you a Haskell for great- wait, wrong book - </p> - <p> - This page is intended to be a listing of useful resources for beginner and experienced Python - programmers alike. This page is generated from a JSON file - <a href="https://gitlab.com/python-discord/projects/site/blob/master/static/resources.json">on GitLab</a> - - if there's a great resource that you love and you don't see it on this page, feel free to submit a - merge request! - </p> - <p> - Some resources aren't free - the below key will help you figure out whether you need to pay for - a resource or not. You can also hover them for more information on the payment (or tap them on - mobile). - </p> - <div class="uk-text-center uk-flex uk-flex-center"> - <div class="payment-icon"> - <img src="{{ static_file("images/payment_icons/green.svg") }}" uk-tooltip="Free" /> - <span>Free</span> - </div> - - <div class="payment-icon"> - <img src="{{ static_file("images/payment_icons/yellow.svg") }}" uk-tooltip="Payment Optional" /> - <span>Payment optional</span> - </div> - - <div class="payment-icon"> - <img src="{{ static_file("images/payment_icons/red.svg") }}" uk-tooltip="Paid" /> - <span>Paid</span> - </div> - </div> - {% if categories is none %} - <div class="uk-alert-danger" uk-alert> - <p> - We were unable to load the <code>resources.json</code> file. If you see this, please - notify us! - </p> - </div> - {% else %} - {% for category_name, category_data in categories.items() %} - <h2 class="uk-heading-divider hover-title" id="{{ category_name.replace(" ", "-").lower() }}"> - {{ category_name }} - - <a href="#{{ category_name.replace(" ", "-").lower() }}" class="uk-text-primary" title="Permanent link to this header"> - <i class="fas fa-paragraph" data-fa-transform="shrink-8"></i> - </a> - <br/> - <p class="uk-article-meta"> - {{ category_data.description }} - </p> - </h2> - {% for item, data in category_data.resources.items() %} - <p> - {% if data["payment"] == "optional" %} - {% set file_path = static_file("images/payment_icons/yellow.svg") %} - {% elif data["payment"] == "paid" %} - {% set file_path = static_file("images/payment_icons/red.svg") %} - {% else %} - {% set file_path = static_file("images/payment_icons/green.svg") %} - {% endif %} - - {% if data["payment_description"] %} - <img class="uk-float-left payment-description" uk-tooltip="{{ data["payment_description"] }}" src="{{ file_path }}" /> - {% else %} - <img class="uk-float-left payment-description" uk-tooltip="{{ data["payment"].title() }}" src="{{ file_path }}" /> - {% endif %} - - <div class="resource-title"> - <strong>{{ item }}</strong> <br /> - <div class="uk-button-group"> - {% for url in data.urls %} - <a class="uk-button uk-button-default uk-button-small" - uk-tooltip="title: {{ url.title }}; pos: bottom" - href="{{ url.url }}"><i class="{{ url.classes }}"></i></a> - {% endfor %} - </div> - </div> - - <br class="uk-float-" /> - <span class="uk-text-meta">{{ data.description }}</span> - </p> - {% endfor %} - {% endfor %} - {% endif %} - </article> - </div> - </div> -{% endblock %}
\ No newline at end of file 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 %} diff --git a/templates/main/navigation.html b/templates/main/navigation.html deleted file mode 100644 index a32ac1c1..00000000 --- a/templates/main/navigation.html +++ /dev/null @@ -1,165 +0,0 @@ -<style> - .uk-navbar-nav:first-child { - margin-left: -20px; - } -</style> -<div class="uk-background-secondary uk-light" uk-sticky="sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky; animation: uk-animation-slide-top; top: 400; bottom: #animation"> - <nav data-uk-navbar class="uk-navbar-container uk-navbar-transparent" uk-navbar="boundary-align: true"> - <div class="uk-navbar-left uk-padding-remove-left"> - <a href="{{ url_for('main.index') }}" class="uk-navbar-item uk-logo uk-padding-remove-left"> - <img src="{{ static_file('logos/logo_banner.svg') }}" class="navbar-logo"/> - </a> - </div> - - <div class="uk-navbar-right"> - <ul class="uk-navbar-nav uk-visible@m"> - {% if current_page == "main.index" %} - <li class="uk-active"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home fa-fw"></i> Home</a></li> - {% else %} - <li><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home fa-fw"></i> Home</a></li> - {% endif %} - - {% if current_page.startswith("wiki.") %} - <li class="uk-active"><a href="{{ url_for('wiki.index') }}"><i class="uk-icon fas fa-book fa-fw"></i> Wiki</a></li> - {% else %} - <li><a href="{{ url_for('wiki.index') }}"><i class="uk-icon fas fa-book fa-fw"></i> Wiki</a></li> - {% endif %} - - <li><a href="{{ url_for('main.invite') }}"><i class="uk-icon fab fa-discord fa-fw"></i> Discord</a></li> - <li><a href="https://www.reddit.com/r/Python/" title="r/Python on Reddit"><i class="uk-icon fab fa-reddit-alien fa-fw"></i> Reddit</a></li> - - {% if is_staff() %} - {% if current_page.startswith("staff.") %} - <li class="uk-active"><a href="{{ url_for('staff.index') }}"><i class="uk-icon fas fa-wrench fa-fw"></i> Staff</a></li> - {% else %} - <li class=""><a href="{{ url_for('staff.index') }}"><i class="uk-icon fas fa-wrench fa-fw"></i> Staff</a></li> - {% endif %} - {% endif %} - </ul> - <ul class="uk-navbar-nav"> - <li> - <a><i class="uk-icon fas fa-chevron-down"></i></a> - <div class="uk-navbar-dropdown uk-background-secondary" uk-dropdown="pos: bottom-right"> - <ul class="uk-nav uk-navbar-dropdown-nav"> - <li class="uk-nav-header uk-hidden@m">Navigation</li> - - {% if current_page == "main.index" %} - <li class="uk-nav-item uk-active uk-hidden@m"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home fa-fw"></i> Home</a></li> - {% else %} - <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('main.index') }}"><i class="uk-icon fas fa-home fa-fw"></i> Home</a></li> - {% endif %} - - {% if current_page.startswith("wiki.") %} - <li class="uk-nav-item uk-active uk-hidden@m"><a href="{{ url_for('wiki.index') }}"><i class="uk-icon fas fa-book fa-fw"></i> Wiki</a></li> - {% else %} - <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('wiki.index') }}"><i class="uk-icon fas fa-book fa-fw"></i> Wiki</a></li> - {% endif %} - - <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('main.invite') }}"><i class="uk-icon fab fa-discord fa-fw"></i> Discord</a></li> - <li class="uk-nav-item uk-hidden@m"><a href="https://www.reddit.com/r/Python/" title="r/Python on Reddit"><i class="uk-icon fab fa-reddit-alien fa-fw"></i> Reddit</a></li> - - {% if is_staff() %} - {% if current_page.startswith("staff.") %} - <li class="uk-nav-item uk-active uk-hidden@m"><a href="{{ url_for('staff.index') }}"><i class="uk-icon fas fa-wrench fa-fw"></i> Staff</a></li> - {% else %} - <li class="uk-nav-item uk-hidden@m"><a href="{{ url_for('staff.index') }}"><i class="uk-icon fas fa-wrench fa-fw"></i> Staff</a></li> - {% endif %} - {% endif %} - <li class="uk-nav-divider uk-hidden@m"></li> - - {% if not debug %} - {% if logged_in %} - <li class="uk-active"><a href="{{ url_for('main.logout') }}"><i class="uk-icon fas fa-unlock"></i> Logout</a></li> - {% else %} - <li class="uk-active"><a href="{{ url_for('discord.login') }}"><i class="uk-icon fas fa-lock"></i> Login with Discord</a></li> - {% endif %} - {% else %} - <li class="uk-active"><a class="debug-mode-item"><i class="uk-icon fas fa-exclamation-triangle"></i> Debug mode</a></li> - {% endif %} - - {% if current_page.startswith("main.info") %} - <li class="uk-nav-header uk-active"><a href="{{ url_for('main.info.index') }}">Information</a></li> - {% else %} - <li class="uk-nav-header"><a href="{{ url_for('main.info.index') }}">Information</a></li> - {% endif %} - - {% if current_page == "main.info.faq" %} - <li class="uk-active"><a href="{{ url_for('main.info.faq') }}">FAQ</a></li> - {% else %} - <li><a href="{{ url_for('main.info.faq') }}">FAQ</a></li> - {% endif %} - - {% if current_page == "main.info.help" %} - <li class="uk-active"><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> - {% else %} - <li><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> - {% endif %} - - {% if current_page == "main.info.resources" %} - <li class="uk-active"><a href="{{ url_for('main.info.resources') }}">Resources</a></li> - {% else %} - <li><a href="{{ url_for('main.info.resources') }}">Resources</a></li> - {% endif %} - - {% if current_page.startswith("main.about.") %} - <li class="uk-nav-header uk-active"><a href="{{ url_for('main.about.index') }}">About</a></li> - {% else %} - <li class="uk-nav-header"><a href="{{ url_for('main.about.index') }}">About</a></li> - {% endif %} - - {% if current_page == "main.about.channels" %} - <li class="uk-active"><a href="{{ url_for('main.about.channels') }}">Channels</a></li> - {% else %} - <li><a href="{{ url_for('main.about.channels') }}">Channels</a></li> - {% endif %} - - {% if current_page == "main.about.partners" %} - <li class="uk-active"><a href="{{ url_for('main.about.partners') }}">Partners</a></li> - {% else %} - <li><a href="{{ url_for('main.about.partners') }}">Partners</a></li> - {% endif %} - - {% if current_page == "main.about.rules" %} - <li class="uk-active"><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li> - {% else %} - <li><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li> - {% endif %} - - {% if current_page.startswith("main.jams") %} - <li class="uk-nav-header uk-active"><a href="{{ url_for('main.jams.index') }}">Code Jams</a></li> - {% else %} - <li class="uk-nav-header"><a href="{{ url_for('main.jams.index') }}">Code Jams</a></li> - {% endif %} - - {% if current_page == "main.jams.index" %} - <li class="uk-active"><a href="{{ url_for('main.jams.index') }}">All Jams</a></li> - {% else %} - <li><a href="{{ url_for('main.jams.index') }}">All Jams</a></li> - {% endif %} - - {% if current_page == "main.jams.profile" %} - <li class="uk-active"><a href="{{ url_for('main.jams.profile') }}">My Profile</a></li> - {% else %} - <li><a href="{{ url_for('main.jams.profile') }}">My Profile</a></li> - {% endif %} - - {% if current_page == "main.jams.user_team_list" %} - <li class="uk-active"><a href="{{ url_for('main.jams.user_team_list') }}">My Teams</a></li> - {% else %} - <li><a href="{{ url_for('main.jams.user_team_list') }}">My Teams</a></li> - {% endif %} - - <li class="uk-nav-divider"></li> - - {% if current_page.startswith("main.about.privacy") %} - <li class="uk-active"><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li> - {% else %} - <li><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li> - {% endif %} - </ul> - </div> - </li> - </ul> - </div> - </nav> -</div> diff --git a/templates/main/ws_test.html b/templates/main/ws_test.html deleted file mode 100644 index 64a7dfc4..00000000 --- a/templates/main/ws_test.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}WS Test{% endblock %} -{% block og_title %}WS Test{% endblock %} -{% block og_description %}A test page for our Websockets implementation{% endblock %} -{% block content %} - <div class="uk-container uk-section"> - <h1>Open your JS console to test</h1> - - <script type="application/javascript"> - let ws = new WebSocket("wss://api.{{ server_name }}/ws/echo"); - - ws.onopen = function(event) { - console.log("WS opened! Use send() to send a message."); - }; - - ws.onmessage = function (event) { - console.log("<- " + event.data); - }; - - function send(text) { - console.log("-> " + text); - ws.send(text); - } - </script> - </div> -{% endblock %} diff --git a/templates/main/ws_test_rst.html b/templates/main/ws_test_rst.html deleted file mode 100644 index a0bae79b..00000000 --- a/templates/main/ws_test_rst.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}WS Test{% endblock %} -{% block og_title %}WS Test{% endblock %} -{% block og_description %}A test page for our Websockets implementation{% endblock %} -{% block content %} - <div class="uk-container uk-section"> - <h1>Enter some text to test.</h1> - - <textarea title="RST Input" id="rst"></textarea> - <input type="button" value="Submit" id="submit-button" /> - - <br /> - - <div id="output"></div> - - <script type="application/javascript"> - let ws = new WebSocket("wss://api.{{ server_name }}/ws/rst"); - - ws.onopen = function(event) { - console.log("WS opened! Use send() to send a message."); - }; - - ws.onmessage = function (event) { - document.getElementById("output").innerHTML = event.data; - }; - - function send(text) { - console.log("-> " + text); - ws.send(text); - } - - document.getElementById("submit-button").onclick = function() { - send( - document.getElementById("rst").value - ); - } - </script> - </div> -{% endblock %} diff --git a/templates/robots.txt b/templates/robots.txt deleted file mode 100644 index fa61be5e..00000000 --- a/templates/robots.txt +++ /dev/null @@ -1,14 +0,0 @@ -{# robots.txt is a little picky about whitespace and newlines - that's why the below looks kind of bad.#} -{% if rules is defined and rules %} -{% for user_agent, disallowed in rules.items() %} -User-agent: {{ user_agent }} -{% for rule in rules %} -Disallow: {{ rule }} -{% endfor %} -{% endfor %} -{% else %} -User-agent: * -Disallow: -{% endif %} - -Sitemap: {{ sitemap_url }} diff --git a/templates/sitemap.xml b/templates/sitemap.xml deleted file mode 100644 index 3d63d3a9..00000000 --- a/templates/sitemap.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<urlset - xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" - xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" - xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" - xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" -> - -{% for url in urls %} - <url> - <loc>{{ url.url }}</loc> - - {% if url.images is defined %} - {% for image in url.images %} - <image:image> - <image:loc>{{ image.url }}</image:loc> - <image:caption>{{ image.caption }}</image:caption> - </image:image> - {% endfor %} - {% endif %} - - {% if url.videos is defined %} - {% for video in url.videos %} - <video:video> - <video:description>{{ video.description }}</video:description> - <video:title>{{ video.title }}</video:title> - - <video:content_loc>{{ video.url }}</video:content_loc> - <video:player_loc>{{ video.player_url }}</video:player_loc> - <video:thumbnail_loc>{{ video.thumbnail_url }}</video:thumbnail_loc> - </video:video> - {% endfor %} - {% endif %} - - {% if url.news_items is defined %} - {% for item in url.news_items %} - <news:news> - <news:publication> - <news:name>Python Discord: {{ item.section }}</news:name> - <news:language>en</news:language> - </news:publication> - - <news:genres>PressRelease, Blog</news:genres> - <news:publication_date>{{ item.date }}</news:publication_date> - <news:title>{{ item.title }}</news:title> - <news:keywords>{{ ", ".join(item.keywords) }}</news:keywords> - </news:news> - {% endfor %} - {% endif %} - - {% if url.last_modified is defined %} - <lastmod>{{ url.last_modified }}</lastmod> - {% endif %} - - {% if url.change_frequency is defined %} - <changefreq>{{ url.change_frequency }}</changefreq> - {% endif %} - - {% if url.priority is defined %} - <priority>{{ "{0:.1f}".format(url.priority) }}</priority> - {% endif %} - </url> -{% endfor %} -</urlset> diff --git a/templates/staff/index.html b/templates/staff/index.html deleted file mode 100644 index 31fddceb..00000000 --- a/templates/staff/index.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Home{% endblock %} -{% block og_title %}Staff | Home{% endblock %} -{% block og_description %}Landing page for the staff management area{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center"> - Management links - </h1> - - <a class="uk-button uk-button-primary" href="{{ url_for("staff.jams.index") }}">Code Jams</a> - {% if manager %} - <a class="uk-button uk-button-primary" href="{{ url_for("staff.tables.index") }}">Table Management</a> - {% endif %} - - <h1 class="uk-title uk-text-center"> - App config - </h1> - <pre> - {{ app_config | safe }} - </pre> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/staff/jams/create.html b/templates/staff/jams/create.html deleted file mode 100644 index c19addd3..00000000 --- a/templates/staff/jams/create.html +++ /dev/null @@ -1,78 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Create{% endblock %} -{% block og_title %}Staff | Jams | Create{% endblock %} -{% block og_description %}Create a brand new code jam{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Code Jam: Create</h1> - - <form action="{{ url_for("staff.jams.create") }}" method="post" class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="title">Title</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="title" id="title" type="text" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number">Number</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="number" id="number" type="text" value="{{ number }}" disabled /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="date_start">Starting date (UTC)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="date_start" id="date_start" type="text" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="date_end">Ending date (UTC)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="date_end" id="date_end" type="text" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="state">State</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <select class="uk-select" name="state" id="state" disabled> - <option value="planning" selected>Planning</option> - </select> - </div> - </div> - - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-align-center uk-text-center"> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button id="done" class="uk-button uk-button-primary" type="submit"> - <i class="uk-icon fa-fw far fa-check"></i> Done - </button> - </div> - </form> - - </div> - - <script type="application/javascript"> - window.onload = () => { - const date_start = flatpickr("#date_start", {enableTime: true, altInput: true}); - const date_end = flatpickr("#date_end", {enableTime: true, altInput: true}); - } - </script> -{% endblock %} diff --git a/templates/staff/jams/edit_basics.html b/templates/staff/jams/edit_basics.html deleted file mode 100644 index 1208e5d2..00000000 --- a/templates/staff/jams/edit_basics.html +++ /dev/null @@ -1,79 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Edit (Basics){% endblock %} -{% block og_title %}Staff | Jams | Edit (Basics){% endblock %} -{% block og_description %}Edit the basic info for a code jam{% endblock %} -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Code Jam: Edit (Basics)</h1> - - <form action="{{ url_for("staff.jams.edit.basics", jam=jam.number) }}" method="post" class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="title">Title</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="title" id="title" type="text" value="{{ jam.title }}" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number">Number</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="number" id="number" type="text" value="{{ jam.number }}" disabled /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="date_start">Starting date (UTC)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="date_start" id="date_start" type="text" value="{{ jam.date_start }}" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="date_end">Ending date (UTC)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="date_end" id="date_end" type="text" value="{{ jam.date_end }}" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="state">State</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <select class="uk-select" name="state" id="state" disabled> - <option value="{{ jam.state }}" selected>{{ jam.state.title() }}</option> - </select> - </div> - </div> - - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-align-center uk-text-center"> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button id="done" class="uk-button uk-button-primary" type="submit"> - <i class="uk-icon fa-fw far fa-check"></i> Done - </button> - </div> - </form> - </div> - - <script type="application/javascript"> - window.onload = () => { - const date_start = flatpickr("#date_start", {enableTime: true, altInput: true}); - const date_end = flatpickr("#date_end", {enableTime: true, altInput: true}); - } - </script> -{% endblock %} diff --git a/templates/staff/jams/edit_ending.html b/templates/staff/jams/edit_ending.html deleted file mode 100644 index a0c5e8ff..00000000 --- a/templates/staff/jams/edit_ending.html +++ /dev/null @@ -1,152 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Edit (Ending Comments){% endblock %} -{% block og_title %}Staff | Jams | Edit (Ending Comments){% endblock %} -{% block og_description %}Edit the ending comments for a code jam{% endblock %} - -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Code Jam: Edit (Ending Comments)</h1> - - <form action="{{ url_for("staff.jams.edit.ending", jam=jam.number) }}" method="post" class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label">Comments (RST)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <div id="editor" class="uk-textarea">{{ jam.end_rst }}</div> - </div> - - <input type="hidden" name="end_rst" id="end_rst" value="{{ jam.end_rst }}" /> - </div> - - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-align-center uk-text-center"> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button class="uk-button uk-button-secondary" type="button" id="preview"> - <i class="uk-icon fa-fw far fa-eye"></i> Preview - </button> - <button id="done" class="uk-button uk-button-primary" type="submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Done - </button> - </div> - </form> - </div> - - <div id="preview-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-body"> - <h2>Code Jam {{ jam.number }}: {{ jam.title }} <a href="{{ jam.repo }}" id="preview-url"><i class="uk-icon fa-fw fab fa-gitlab"></i></a></h2> - <p class="uk-text-meta">Theme: <span id="preview-theme">{{ jam.theme }}</span></p> - - <div id="preview-div"> - {{ jam.end_rst | safe }} - </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="state-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Close - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - - window.onload = () => { - let csrf_token = "{{ csrf_token() }}"; - let modal = UIkit.modal(document.getElementById("preview-modal")); - let preview_url = "{{ url_for("staff.render") }}"; - - function do_preview(callback) { - let oReq = new XMLHttpRequest(); - - oReq.addEventListener("load", function () { - let response = JSON.parse(this.responseText); - - if (response.error !== undefined) { - document.getElementById("done").disabled = true; - - if (response.error_lines !== undefined) { - editor.session.setAnnotations(response.error_lines); - document.getElementById("preview-div").innerHTML = "<h3>Error - see editor margin</h3>"; - } else { - console.log("Error: " + response.error); - document.getElementById("preview-div").innerHTML = "<h3>Error</h3><p>" + response.error + "<p>"; - } - } else { - document.getElementById("done").disabled = false; - document.getElementById("preview-div").innerHTML = response.data; - - editor.session.setAnnotations([]); - } - - if (callback !== undefined) { - callback(); - } - }); - - let data = editor.getValue(); - - if (data.replace("\s", "").length < 1) { - document.getElementById("done").disabled = true; - - if (callback !== undefined) { - UIkit.notification({ - "message": "Please enter some text to preview", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - return false; - } - - oReq.open("POST", preview_url); - - oReq.setRequestHeader("Content-type", "application/json"); - oReq.setRequestHeader("X-CSRFToken", csrf_token); - - oReq.send(JSON.stringify({"data": editor.getValue()})); - - return false; - } - - document.getElementById("preview").onclick = function () { - do_preview(function () { - modal.show(); - }) - }; - - let editor = ace.edit("editor"); - let timer; - - editor.session.setMode("ace/mode/rst"); - editor.session.setUseWrapMode(true); - - editor.setTheme("ace/theme/iplastic"); - editor.setShowPrintMargin(false); - - editor.on("input", function () { - document.getElementById("done").disabled = true; - document.getElementById("end_rst").value = editor.getValue(); - - if (timer !== undefined) { - clearTimeout(timer); - } - timer = setTimeout(do_preview, 1000); - }); - }; - </script> -{% endblock %} diff --git a/templates/staff/jams/edit_info.html b/templates/staff/jams/edit_info.html deleted file mode 100644 index 75df1957..00000000 --- a/templates/staff/jams/edit_info.html +++ /dev/null @@ -1,309 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Edit (Info){% endblock %} -{% block og_title %}Staff | Jams | Edit (Info){% endblock %} -{% block og_description %}Edit the basic info for a code jam{% endblock %} - -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Code Jam: Edit (Info)</h1> - - <form action="{{ url_for("staff.jams.edit.info", jam=jam.number) }}" method="post" class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="repo">Repo URL</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="repo" id="repo" type="text" value="{{ jam.repo }}" required /> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="theme">Theme</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <input class="uk-input" name="theme" id="theme" type="text" value="{{ jam.theme }}" required /> - </div> - </div> - - <div> - <div class="uk-form-label"> - <label class="uk-form-label"> - Info (RST) - <br /> - <span class="uk-text-meta">Will be available as soon as the jam state is "Announced"</span> - <br /> - <br /> - <button class="uk-button uk-button-secondary" type="button" id="preview-info-button"> - <i class="uk-icon fa-fw far fa-eye"></i> Preview - </button> - </label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <div id="info_editor" class="uk-textarea editor">{{ jam.info_rst }}</div> - </div> - - <input type="hidden" name="info_rst" id="info_rst" value="{{ jam.info_rst }}" /> - </div> - - <div> - <div class="uk-form-label"> - <label class="uk-form-label"> - Task (RST) - <br/> - <span class="uk-text-meta">Will not be available until the jam state is "Running"</span> - <br /> - <br /> - <button class="uk-button uk-button-secondary" type="button" id="preview-task-button"> - <i class="uk-icon fa-fw far fa-eye"></i> Preview - </button> - </label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <div id="task_editor" class="uk-textarea editor">{{ jam.task_rst }}</div> - </div> - - <input type="hidden" name="task_rst" id="task_rst" value="{{ jam.task_rst }}" /> - </div> - - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-align-center uk-text-center"> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button id="done" class="uk-button uk-button-primary" type="submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Done - </button> - </div> - </form> - </div> - - <div id="preview-info-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-body"> - <h2>Code Jam {{ jam.number }}: {{ jam.title }} <a href="{{ jam.repo }}" id="preview-info-url"><i class="uk-icon fa-fw fab fa-gitlab"></i></a></h2> - <p class="uk-text-meta">Theme: <span id="preview-info-theme">{{ jam.theme }}</span></p> - - <div id="preview-info-div"> - {{ jam.task_html | safe }} - </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="state-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Close - </button> - </div> - </div> - </div> - </div> - - <div id="preview-task-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-body"> - <h2>Code Jam {{ jam.number }}: {{ jam.title }} <a href="{{ jam.repo }}" id="preview-task-url"><i class="uk-icon fa-fw fab fa-gitlab"></i></a></h2> - <p class="uk-text-meta">Theme: <span id="preview-task-theme">{{ jam.theme }}</span></p> - - <div id="preview-task-div"> - {{ jam.task_html | safe }} - </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="state-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Close - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - - window.onload = () => { - let csrf_token = "{{ csrf_token() }}"; - let info_modal = UIkit.modal(document.getElementById("preview-info-modal")); - let task_modal = UIkit.modal(document.getElementById("preview-task-modal")); - let preview_url = "{{ url_for("staff.render") }}"; - - function do_preview_info(callback) { - let oReq = new XMLHttpRequest(); - - oReq.addEventListener("load", function () { - let response = JSON.parse(this.responseText); - - if (response.error !== undefined) { - document.getElementById("done").disabled = true; - - if (response.error_lines !== undefined) { - info_editor.session.setAnnotations(response.error_lines); - document.getElementById("preview-info-div").innerHTML = "<h3>Error - see editor margin</h3>"; - } else { - console.log("Error: " + response.error); - document.getElementById("preview-info-div").innerHTML = "<h3>Error</h3><p>" + response.error + "<p>"; - } - } else { - document.getElementById("done").disabled = false; - document.getElementById("preview-info-div").innerHTML = response.data; - - info_editor.session.setAnnotations([]); - } - - if (callback !== undefined) { - callback(); - } - }); - - let data = info_editor.getValue(); - - if (data.replace("\s", "").length < 1) { - document.getElementById("done").disabled = true; - - if (callback !== undefined) { - UIkit.notification({ - "message": "Please enter some text to preview", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - return false; - } - - oReq.open("POST", preview_url); - - oReq.setRequestHeader("Content-type", "application/json"); - oReq.setRequestHeader("X-CSRFToken", csrf_token); - - oReq.send(JSON.stringify({"data": data})); - - return false; - } - - function do_preview_task(callback) { - let oReq = new XMLHttpRequest(); - - oReq.addEventListener("load", function () { - let response = JSON.parse(this.responseText); - - if (response.error !== undefined) { - document.getElementById("done").disabled = true; - - if (response.error_lines !== undefined) { - task_editor.session.setAnnotations(response.error_lines); - document.getElementById("preview-task-div").innerHTML = "<h3>Error - see editor margin</h3>"; - } else { - console.log("Error: " + response.error); - document.getElementById("preview-task-div").innerHTML = "<h3>Error</h3><p>" + response.error + "<p>"; - } - } else { - document.getElementById("done").disabled = false; - document.getElementById("preview-task-div").innerHTML = response.data; - - task_editor.session.setAnnotations([]); - } - - if (callback !== undefined) { - callback(); - } - }); - - let data = task_editor.getValue(); - - if (data.replace("\s", "").length < 1) { - document.getElementById("done").disabled = true; - - if (callback !== undefined) { - UIkit.notification({ - "message": "Please enter some text to preview", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - return false; - } - - oReq.open("POST", preview_url); - - oReq.setRequestHeader("Content-type", "application/json"); - oReq.setRequestHeader("X-CSRFToken", csrf_token); - - oReq.send(JSON.stringify({"data": data})); - - return false; - } - - document.getElementById("preview-task-button").onclick = function () { - do_preview_task(function () { - task_modal.show(); - }) - }; - - document.getElementById("preview-info-button").onclick = function () { - do_preview_info(function () { - info_modal.show(); - }) - }; - - document.getElementById("theme").oninput = function () { - document.getElementById("preview-task-theme").textContent = this.value; - document.getElementById("preview-info-theme").textContent = this.value; - }; - - document.getElementById("repo").oninput = function () { - document.getElementById("preview-task-url").href = this.value; - document.getElementById("preview-info-url").href = this.value; - }; - - let info_editor = ace.edit("info_editor"); - let task_editor = ace.edit("task_editor"); - let info_timer, task_timer; - - info_editor.session.setMode("ace/mode/rst"); - info_editor.session.setUseWrapMode(true); - - info_editor.setTheme("ace/theme/iplastic"); - info_editor.setShowPrintMargin(false); - - info_editor.on("input", function () { - document.getElementById("done").disabled = true; - document.getElementById("info_rst").value = info_editor.getValue(); - - if (info_timer !== undefined) { - clearTimeout(info_timer); - } - info_timer = setTimeout(do_preview_info, 1000); - }); - - task_editor.session.setMode("ace/mode/rst"); - task_editor.session.setUseWrapMode(true); - - task_editor.setTheme("ace/theme/iplastic"); - task_editor.setShowPrintMargin(false); - - task_editor.on("input", function () { - document.getElementById("done").disabled = true; - document.getElementById("task_rst").value = task_editor.getValue(); - - if (task_timer !== undefined) { - clearTimeout(task_timer); - } - task_timer = setTimeout(do_preview_task, 1000); - }); - }; - </script> -{% endblock %} diff --git a/templates/staff/jams/forms/preamble_edit.html b/templates/staff/jams/forms/preamble_edit.html deleted file mode 100644 index 85747713..00000000 --- a/templates/staff/jams/forms/preamble_edit.html +++ /dev/null @@ -1,150 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Forms | Edit Preamble{% endblock %} -{% block og_title %}Staff | Forms | Edit Preamble{% endblock %} - -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Form: Edit Preamble</h1> - - <form action="{{ url_for("staff.jams.forms.preamble.edit", jam=jam.number) }}" method="post" class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label">Preamble (RST)</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <div id="editor" class="uk-textarea">{{ form.preamble_rst }}</div> - </div> - - <input type="hidden" name="preamble_rst" id="preamble_rst" value="{{ form.preamble_rst }}" /> - </div> - - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <div class="uk-align-center uk-text-center"> - <a id="back" class="uk-button uk-button-default" href="{{ url_for("staff.jams.forms.view", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Back - </a> - <button class="uk-button uk-button-secondary" type="button" id="preview"> - <i class="uk-icon fa-fw far fa-eye"></i> Preview - </button> - <button id="done" class="uk-button uk-button-primary" type="submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Done - </button> - </div> - </form> - </div> - - <div id="preview-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-body"> - <h2>Form: {{ jam.number }}</h2> - - <div id="preview-div"> - {{ jam.preamble_html | safe }} - </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="state-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Close - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - - window.onload = () => { - let csrf_token = "{{ csrf_token() }}"; - let modal = UIkit.modal(document.getElementById("preview-modal")); - let preview_url = "{{ url_for("staff.render") }}"; - - function do_preview(callback) { - let oReq = new XMLHttpRequest(); - - oReq.addEventListener("load", function () { - let response = JSON.parse(this.responseText); - - if (response.error !== undefined) { - document.getElementById("done").disabled = true; - - if (response.error_lines !== undefined) { - editor.session.setAnnotations(response.error_lines); - document.getElementById("preview-div").innerHTML = "<h3>Error - see editor margin</h3>"; - } else { - console.log("Error: " + response.error); - document.getElementById("preview-div").innerHTML = "<h3>Error</h3><p>" + response.error + "<p>"; - } - } else { - document.getElementById("done").disabled = false; - document.getElementById("preview-div").innerHTML = response.data; - - editor.session.setAnnotations([]); - } - - if (callback !== undefined) { - callback(); - } - }); - - let data = editor.getValue(); - - if (data.replace("\s", "").length < 1) { - document.getElementById("done").disabled = true; - - if (callback !== undefined) { - UIkit.notification({ - "message": "Please enter some text to preview", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - return false; - } - - oReq.open("POST", preview_url); - - oReq.setRequestHeader("Content-type", "application/json"); - oReq.setRequestHeader("X-CSRFToken", csrf_token); - - oReq.send(JSON.stringify({"data": editor.getValue()})); - - return false; - } - - document.getElementById("preview").onclick = function () { - do_preview(function () { - modal.show(); - }) - }; - - let editor = ace.edit("editor"); - let timer; - - editor.session.setMode("ace/mode/rst"); - editor.session.setUseWrapMode(true); - - editor.setTheme("ace/theme/iplastic"); - editor.setShowPrintMargin(false); - - editor.on("input", function () { - document.getElementById("done").disabled = true; - document.getElementById("preamble_rst").value = editor.getValue(); - - if (timer !== undefined) { - clearTimeout(timer); - } - timer = setTimeout(do_preview, 1000); - }); - }; - </script> -{% endblock %} diff --git a/templates/staff/jams/forms/questions_edit.html b/templates/staff/jams/forms/questions_edit.html deleted file mode 100644 index d6fe082c..00000000 --- a/templates/staff/jams/forms/questions_edit.html +++ /dev/null @@ -1,354 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Question Edit{% endblock %} -{% block og_title %}Staff | Jams | Question Edit{% endblock %} -{% block og_description %}Edit a question{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1>Question Edit</h1> - - <form class="uk-form-horizontal" method="post" action="{{ url_for("staff.jams.forms.questions.edit", question=question.id) }}"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="title">Title</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="title" name="title" class="uk-input" value="{{ question.title }}"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="optional">Optional</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="optional" name="optional"> - {% if question.optional %} - <option value="optional" selected>Optional</option> - <option value="required">Required</option> - {% else %} - <option value="optional">Optional</option> - <option value="required" selected>Required</option> - {% endif %} - </select> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="type">Type</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="type" name="type"> - {% if question.type == "checkbox" %} - <option value="checkbox" selected>Checkbox</option> - {% else %} - <option value="checkbox">Checkbox</option> - {% endif %} - - {% if question.type == "email" %} - <option value="email" selected>Email</option> - {% else %} - <option value="email">Email</option> - {% endif %} - - {% if question.type == "number" %} - <option value="number" selected>Number</option> - {% else %} - <option value="number">Number</option> - {% endif %} - - {% if question.type == "radio" %} - <option value="radio" selected>Radio</option> - {% else %} - <option value="radio">Radio</option> - {% endif %} - - {% if question.type == "range" %} - <option value="range" selected>Range</option> - {% else %} - <option value="range">Range</option> - {% endif %} - - {% if question.type == "slider" %} - <option value="slider" selected>Slider</option> - {% else %} - <option value="slider">Slider</option> - {% endif %} - - {% if question.type == "textarea" %} - <option value="textarea" selected>Text (Block)</option> - {% else %} - <option value="textarea">Text (Block)</option> - {% endif %} - - {% if question.type == "text" %} - <option value="text" selected>Text (Line)</option> - {% else %} - <option value="text">Text (Line)</option> - {% endif %} - </select> - </div> - </div> - - {% if question.type == "radio" %} - <div id="radio-section"> - {% else %} - <div id="radio-section" hidden="hidden"> - {% endif %} - <br /> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-primary uk-width-1-1" id="radio-add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="radio-add-input" class="uk-input" placeholder="Item"> - </div> - </div> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-danger uk-width-1-1" id="radio-remove-button"><i class="uk-icon fa-fw far fa-minus"></i> Remove</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="radio-options"> - <option hidden="hidden" disabled selected value="none"></option> - - {% for option in question.data.options %} - <option value="{{ option }}">{{ option }}</option> - {% endfor %} - </select> - {% if question.data.options %} - <input type="hidden" id="options" name="options" value="{{ "{\"options\": " + question.data.options.__str__() + "}" | safe }}"> - {% else %} - <input type="hidden" id="options" name="options" value="{{ "{\"options\": []}" }}"> - {% endif %} - </div> - </div> - </div> - - {% if question.type in ["number", "range", "slider"] %} - <div id="number-section"> - {% else %} - <div id="number-section" hidden="hidden"> - {% endif %} - <br /> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="min">Min Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="min" name="min" class="uk-input" value="{{ question.data.min }}"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="max">Max Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="max" name="max" class="uk-input" value="{{ question.data.max }}"> - </div> - </div> - </div> - - <br /> - - <div> - <input type="hidden" name="csrf_token" id="csrf_token" value="{{ csrf_token() }}"/> - - <a class="uk-button uk-button-danger uk-modal-close" href="{{ url_for("staff.jams.forms.questions") }}"> - <i class="uk-icon fa-fw far fa-times"></i> Cancel - </a> - <button class="uk-button uk-button-primary" type="submit" id="question-submit"> - <i class="uk-icon fa-fw far fa-check"></i> Save - </button> - </div> - </form> - </div> - - <script type="application/javascript"> - "use strict"; - const new_question_title = document.getElementById("title"); - const new_question_optional = document.getElementById("optional"); - const new_question_type = document.getElementById("type"); - - const radio_section = document.getElementById("radio-section"); - - const radio_add_button = document.getElementById("radio-add-button"); - const radio_add_input = document.getElementById("radio-add-input"); - const radio_remove_button = document.getElementById("radio-remove-button"); - const radio_options = document.getElementById("radio-options"); - const hidden_radio_options = document.getElementById("options"); - - const number_section = document.getElementById("number-section"); - - const number_min = document.getElementById("min"); - const number_max = document.getElementById("max"); - - const submit_button = document.getElementById("question-submit"); - - let current_radio_options; - - {% if question.data.options %} - current_radio_options = {{ question.data.options | safe }}; - {% else %} - current_radio_options = Array(); - {% endif %} - - new_question_type.onchange = function() { - if (this.value === "checkbox") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "email") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "number") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "radio") { - radio_section.removeAttribute("hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "range") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "slider") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "textarea") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "text") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } - - checkValid(); - }; - - new_question_title.oninput = checkValid; - new_question_optional.onchange = checkValid; - - radio_add_input.onkeyup = function(event) { - event.preventDefault(); - - if (event.which === 13 || event.keyCode === 13) { - radio_add_button.onclick(undefined); - } - }; - - radio_add_button.onclick = function() { - let value = radio_add_input.value; - - if (value.length < 1) { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - let index = current_radio_options.indexOf(value); - - if (index > -1 || value === "none") { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - radio_add_input.classList.remove("uk-form-danger"); - radio_add_input.value = ""; - - let element = document.createElement("option"); - element.value = value; - element.text = value; - - radio_options.appendChild(element); - current_radio_options.push(value); - hidden_radio_options.value = JSON.stringify({"options": current_radio_options}); - } - } - - checkValid(); - }; - - radio_remove_button.onclick = function() { - let value = radio_options.value; - - if (value === "none") { - return; - } - - let index = current_radio_options.indexOf(value); - - if (index < 0) { // We have a problem! - console.log("Unable to remove value from radio values because it doesn't exist: " + value) - } else { - current_radio_options.splice(index, 1); - } - - for (let element of radio_options.getElementsByTagName("option")) { - if (element.value === "none") { - continue; - } - - if (element.value === value) { - radio_options.removeChild(element); - } - } - - hidden_radio_options.value = JSON.stringify({"options": current_radio_options}); - radio_options.value = "none"; - radio_add_input.focus(); - checkValid(); - }; - - number_min.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkValid(); - }; - - number_max.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkValid(); - }; - - function checkValid() { - if (new_question_title.value.length < 1) { - return setButtonEnabled(false); - } - - let question_type = new_question_type.value; - - if (question_type === "radio") { - if (current_radio_options.length < 1) { - return setButtonEnabled(false); - } - } - - if ( question_type === "number" - || question_type === "range" - || question_type === "slider" - ) { - if (isNaN(parseInt(number_min.value))) { - return setButtonEnabled(false); - } - if (isNaN(parseInt(number_max.value))) { - return setButtonEnabled(false); - } - - if (number_min.value.length < 1 || number_max.value.length < 1) { - return setButtonEnabled(false); - } - } - - return setButtonEnabled(true); - } - - function setButtonEnabled(enabled) { - submit_button.disabled = !enabled; - } - </script> -{% endblock %} diff --git a/templates/staff/jams/forms/questions_view.html b/templates/staff/jams/forms/questions_view.html deleted file mode 100644 index f8eeea40..00000000 --- a/templates/staff/jams/forms/questions_view.html +++ /dev/null @@ -1,593 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Questions{% endblock %} -{% block og_title %}Staff | Jams | Questions{% endblock %} -{% block og_description %}Manage all created questions{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1>Questions List</h1> - - <a class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"><i class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - <button class="uk-button uk-button-primary" id="add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add Question</button> - {# <a class="uk-button uk-button-secondary" target="_blank" href="{{ url_for("staff.index") }}"><i class="uk-icon fa-fw far fa-eye"></i> Preview</a> #} - - {% if not questions %} - <p id="no-questions-paragraph">No questions found. Add one above!</p> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table" hidden="hidden"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th><strong>ID</strong></th> - <th class="uk-table-shrink">Optional</th> - <th>Title</th> - <th class="uk-table-shrink">Type</th> - <th>Data</th> - </tr> - </thead> - <tbody id="table-body"> - </tbody> - </table> - {% else %} - <p id="no-questions-paragraph" hidden="hidden">No questions found. Add one above!</p> - - <div class="uk-overflow-auto"> - <br /> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th><strong>ID</strong></th> - <th class="uk-table-shrink">Optional</th> - <th>Title</th> - <th class="uk-table-shrink">Type</th> - <th>Data</th> - </tr> - </thead> - <tbody id="table-body"> - {% for question in questions %} - <tr id="row-{{ question.id }}"> - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-question-button" data-question-id="{{ question.id }}"><i class="uk-icon fa-fw far fa-trash"></i></button> - <a href="{{ url_for("staff.jams.forms.questions.edit", question=question.id) }}" class="uk-button-small uk-button uk-button-primary edit-question-button"><i class="uk-icon fa-fw far fa-pencil"></i></a> - </td> - <td class="uk-text-truncate" title="{{ question.id }}">{{ question.id }}</td> - <td class="uk-table-shrink"> - {% if question.optional %} - <i class="uk-icon uk-text-success fa-fw far fa-check"></i> - {% else %} - <i class="uk-icon uk-text-danger fa-fw far fa-times"></i> - {% endif %} - </td> - <td title="{{ question.title }}">{{ question.title }}</td> - <td class="uk-table-shrink" title="{{ question.type.title() }}">{{ question.type.title() }}</td> - <td> - {% if question.type == "text" %} - - {% elif question.type == "number" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% elif question.type == "checkbox" %} - - {% elif question.type == "email" %} - - {% elif question.type == "textarea" %} - - {% elif question.type == "radio" %} - <ul> - {% for option in question.data.options %} - <li>{{ option }}</li> - {% endfor %} - </ul> - {% elif question.type == "range" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% elif question.type == "slider" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% else %} - {{ question.data }} - {% endif %} - </td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - {% endif %} - </div> - - <div id="question-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">Add Question</h2> - </div> - - <div class="uk-modal-body"> - <form class="uk-form-horizontal"> - <div id="loading-spinner" class="uk-text-center uk-margin-small-top" hidden="hidden"> - <div uk-spinner></div> - </div> - <div id="new-question-section"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-title">Title</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="new-question-title" class="uk-input"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-optional">Optional</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="new-question-optional"> - <option hidden="hidden" disabled selected value="none"></option> - <option value="optional">Optional</option> - <option value="required">Required</option> - </select> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-type">Type</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="new-question-type"> - <option hidden="hidden" disabled selected value="none"></option> - <option value="checkbox">Checkbox</option> - <option value="email">Email</option> - <option value="number">Number</option> - <option value="radio">Radio</option> - <option value="range">Range</option> - <option value="slider">Slider</option> - <option value="textarea">Text (Block)</option> - <option value="text">Text (Line)</option> - </select> - </div> - </div> - </div> - - <div id="radio-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-primary uk-width-1-1" id="radio-add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="radio-add-input" class="uk-input" placeholder="Item"> - </div> - </div> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-danger uk-width-1-1" id="radio-remove-button"><i class="uk-icon fa-fw far fa-minus"></i> Remove</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="radio-options"> - <option hidden="hidden" disabled selected value="none"></option> - </select> - </div> - </div> - </div> - - <div id="number-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number-min">Min Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="number-min" class="uk-input"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number-max">Max Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="number-max" class="uk-input"> - </div> - </div> - </div> - </form> - </div> - - <div class="uk-modal-footer"> - <div class="uk-text-center"> - <button class="uk-button uk-button-danger uk-modal-close" type="button" id="state-cancel"> - <i class="uk-icon fa-fw far fa-times"></i> Cancel - </button> - <button class="uk-button uk-button-primary" type="button" id="question-submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Save - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - const table_body = document.getElementById("table-body"); - const table = document.getElementById("table"); - const no_questions_paragraph = document.getElementById("no-questions-paragraph"); - - let all_questions = {{ question_ids | safe }}; - const question_edit_url = "{{ url_for("staff.jams.forms.questions.edit", question="NONE") }}"; - - const add_button = document.getElementById("add-button"); - const modal = UIkit.modal(document.getElementById("question-modal")); - const loading_spinner = document.getElementById("loading-spinner"); - - const new_question_section = document.getElementById("new-question-section"); - const new_question_title = document.getElementById("new-question-title"); - const new_question_optional = document.getElementById("new-question-optional"); - const new_question_type = document.getElementById("new-question-type"); - - const radio_section = document.getElementById("radio-section"); - - const radio_add_button = document.getElementById("radio-add-button"); - const radio_add_input = document.getElementById("radio-add-input"); - const radio_remove_button = document.getElementById("radio-remove-button"); - const radio_options = document.getElementById("radio-options"); - - const number_section = document.getElementById("number-section"); - - const number_min = document.getElementById("number-min"); - const number_max = document.getElementById("number-max"); - - const submit_button = document.getElementById("question-submit"); - - let current_radio_options = Array(); - - add_button.onclick = function() { - clearModal(); - checkModal(); - modal.show(); - }; - - new_question_type.onchange = function() { - if (this.value === "checkbox") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "email") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "number") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "radio") { - radio_section.removeAttribute("hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "range") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "slider") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "textarea") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "text") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } - - checkModal(); - }; - - new_question_title.oninput = checkModal; - new_question_optional.onchange = checkModal; - - radio_add_input.onkeyup = function(event) { - event.preventDefault(); - - if (event.which === 13 || event.keyCode === 13) { - radio_add_button.onclick(undefined); - } - }; - - radio_add_button.onclick = function() { - let value = radio_add_input.value; - - if (value.length < 1) { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - let index = current_radio_options.indexOf(value); - - if (index > -1 || value === "none") { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - radio_add_input.classList.remove("uk-form-danger"); - radio_add_input.value = ""; - - let element = document.createElement("option"); - element.value = value; - element.text = value; - - radio_options.appendChild(element); - current_radio_options.push(value); - } - } - - checkModal(); - }; - - radio_remove_button.onclick = function() { - let value = radio_options.value; - - if (value === "none") { - return; - } - - let index = current_radio_options.indexOf(value); - - if (index < 0) { // We have a problem! - console.log("Unable to remove value from radio values because it doesn't exist: " + value) - } else { - current_radio_options.splice(index, 1); - } - - for (let element of radio_options.getElementsByTagName("option")) { - if (element.value === "none") { - continue; - } - - if (element.value === value) { - radio_options.removeChild(element); - } - } - - radio_options.value = "none"; - radio_add_input.focus(); - checkModal(); - }; - - number_min.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkModal(); - }; - - number_max.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkModal(); - }; - - submit_button.onclick = function () { - let type = new_question_type.value; - let optional = new_question_optional.value === "optional"; - let title = new_question_title.value; - - let question_data = { - "type": type, - "optional": optional, - "title": title - }; - - if (type === "radio") { - question_data.data = {"options": current_radio_options}; - } else if (type === "number" - || type === "range" - || type === "slider") { - question_data.data = { - "max": parseInt(number_max.value), - "min": parseInt(number_min.value) - }; - } - - number_section.setAttribute("hidden", "hidden"); - new_question_section.setAttribute("hidden", "hidden"); - radio_section.setAttribute("hidden", "hidden"); - loading_spinner.removeAttribute("hidden"); - - actions.create_question(question_data, function(result, data) { - if (result) { - question_data["id"] = data.id; - addToTable(question_data); - modal.hide(); - clearModal(); - - UIkit.notification({ - "message": "Question added", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to create question", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - }; - - const toTitleCase = (str) => str.replace(/\b\S/g, t => t.toUpperCase()); - - function hookUpDeleteButtons() { - for (let element of document.getElementsByClassName("delete-question-button")) { - element.onclick = function() { - let question_id = this.getAttribute("data-question-id"); - let row = document.getElementById("row-" + question_id); - - actions.delete_question(question_id, function(result, data) { - if (result) { - document.getElementById("table-body").removeChild(row); - UIkit.notification({ - "message": "Question deleted", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to delete question", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } - } - } - - function clearModal() { - // Existing question section - loading_spinner.setAttribute("hidden", "hidden"); - - new_question_section.removeAttribute("hidden"); - - // New question section - new_question_title.value = ""; - new_question_optional.value = "none"; - new_question_type.value = "none"; - - // Radio question section - radio_section.setAttribute("hidden", "hidden"); - - radio_add_input.value = ""; - radio_options.innerHTML = "<option hidden=\"hidden\" disabled selected value=\"none\"></option>"; - radio_options.value = "none"; - - current_radio_options = Array(); - - // Number question section - number_section.setAttribute("hidden", "hidden"); - } - - function checkModal() { - if (new_question_title.value.length < 1) { - return setButtonEnabled(false); - } - - if (new_question_optional.value === "none") { - return setButtonEnabled(false); - } - - let question_type = new_question_type.value; - - if (question_type === "none") { - return setButtonEnabled(false); - } - - if (question_type === "radio") { - if (current_radio_options.length < 1) { - return setButtonEnabled(false); - } - } - - if ( question_type === "number" - || question_type === "range" - || question_type === "slider" - ) { - if (isNaN(parseInt(number_min.value))) { - return setButtonEnabled(false); - } - if (isNaN(parseInt(number_max.value))) { - return setButtonEnabled(false); - } - - if (number_min.value.length < 1 || number_max.value.length < 1) { - return setButtonEnabled(false); - } - } - - return setButtonEnabled(true); - } - - function setButtonEnabled(enabled) { - submit_button.disabled = !enabled; - } - - function addToTable(question) { - console.log(question); - if (all_questions.indexOf(question.id) === -1) { - all_questions.push(question.id); - - let element = document.createElement("tr"); - element.id = "row-" + question.id; - element.innerHTML = getRowHTML(question); - - table_body.appendChild(element); - } - - if (all_questions.length > 0) { - table.removeAttribute("hidden"); - no_questions_paragraph.setAttribute("hidden", "hidden"); - } - hookUpDeleteButtons(); - } - - function getRowHTML(question) { - let optional; - let data; - - if (question.optional) { - optional = "<i class=\"uk-icon uk-text-success fa-fw far fa-check\"></i>" - } else { - optional = "<i class=\"uk-icon uk-text-danger fa-fw far fa-times\"></i>" - } - - if (question.type === "number" || question.type === "range" || question.type === "slider") { - data = ` -<i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> ${question.data.max} -<br /> -<i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> ${question.data.min} - ` - - } else if (question.type === "radio") { - data = "<ul>"; - - for (let option of question.data.options) { - data = data + `<li>${option}</li>` - } - data = data + "</ul>"; - } else { - data = "" - } - - let type = toTitleCase(question.type); - let q_url = question_edit_url.replace("NONE", question.id); - - const row = ` - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-question-button" data-question-id="${question.id}"><i class="uk-icon fa-fw far fa-trash"></i></button> - <a href="${q_url}" class="uk-button-small uk-button uk-button-primary edit-question-button"><i class="uk-icon fa-fw far fa-pencil"></i></a> - </td> - <td class="uk-text-truncate" title="${question.id}">${question.id}</td> - <td class="uk-table-shrink">${optional}</td> - <td title="${question.title}">${question.title}</td> - <td class="uk-table-shrink" title="${type}">${type}</td> - <td>${data}</td> - `; - return row - } - - hookUpDeleteButtons(); - </script> -{% endblock %} diff --git a/templates/staff/jams/forms/view.html b/templates/staff/jams/forms/view.html deleted file mode 100644 index 49ea672d..00000000 --- a/templates/staff/jams/forms/view.html +++ /dev/null @@ -1,755 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Form{% endblock %} -{% block og_title %}Staff | Jams | Form{% endblock %} -{% block og_description %}Manage the form for a code jam{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1>Application Form {{ jam.number }}: {{ jam.title }}</h1> - - <a class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"><i class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - <a class="uk-button uk-button-secondary" href="{{ url_for("staff.jams.forms.preamble.edit", jam=jam.number) }}" id="preamble-button"><i class="uk-icon fa-fw far fa-pencil"></i> Edit Preamble</a> - <button class="uk-button uk-button-primary" id="add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add Question</button> - {# <a class="uk-button uk-button-secondary" target="_blank" href="{{ url_for("staff.index") }}"><i class="uk-icon fa-fw far fa-eye"></i> Preview</a> #} - - {% if not questions %} - <p id="no-questions-paragraph">No questions found. Add one above!</p> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table" hidden="hidden"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th><strong>ID</strong></th> - <th class="uk-table-shrink">Optional</th> - <th>Title</th> - <th class="uk-table-shrink">Type</th> - <th>Data</th> - </tr> - </thead> - <tbody id="table-body"> - </tbody> - </table> - {% else %} - <p id="no-questions-paragraph" hidden="hidden">No questions found. Add one above!</p> - - <div class="uk-overflow-auto"> - <br /> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th><strong>ID</strong></th> - <th class="uk-table-shrink">Optional</th> - <th>Title</th> - <th class="uk-table-shrink">Type</th> - <th>Data</th> - </tr> - </thead> - <tbody id="table-body"> - {% for question in questions %} - <tr id="row-{{ question.id }}"> - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-question-button" data-question-id="{{ question.id }}"><i class="uk-icon fa-fw far fa-times"></i></button> - </td> - <td class="uk-text-truncate" title="{{ question.id }}">{{ question.id }}</td> - <td class="uk-table-shrink"> - {% if question.optional %} - <i class="uk-icon uk-text-success fa-fw far fa-check"></i> - {% else %} - <i class="uk-icon uk-text-danger fa-fw far fa-times"></i> - {% endif %} - </td> - <td title="{{ question.title }}">{{ question.title }}</td> - <td class="uk-table-shrink" title="{{ question.type.title() }}">{{ question.type.title() }}</td> - <td> - {% if question.type == "text" %} - - {% elif question.type == "number" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% elif question.type == "checkbox" %} - - {% elif question.type == "email" %} - - {% elif question.type == "textarea" %} - - {% elif question.type == "radio" %} - <ul> - {% for option in question.data.options %} - <li>{{ option }}</li> - {% endfor %} - </ul> - {% elif question.type == "range" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% elif question.type == "slider" %} - <i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> {{ question.data.max }} - <br /> - <i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> {{ question.data.min }} - {% else %} - {{ question.data }} - {% endif %} - </td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - {% endif %} - </div> - - <div id="question-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">Add Question</h2> - </div> - - <div class="uk-modal-body"> - <form class="uk-form-horizontal"> - <div id="question-source-section"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="question-source">Source</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="question-source" required> - <option hidden="hidden" disabled selected value="none"></option> - <option value="new">New</option> - <option value="existing">Existing</option> - </select> - </div> - </div> - </div> - <div id="loading-spinner" class="uk-text-center uk-margin-small-top" hidden="hidden"> - <div uk-spinner></div> - </div> - <div id="new-question-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-title">Title</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="new-question-title" class="uk-input"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-optional">Optional</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="new-question-optional"> - <option hidden="hidden" disabled selected value="none"></option> - <option value="optional">Optional</option> - <option value="required">Required</option> - </select> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="new-question-type">Type</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="new-question-type"> - <option hidden="hidden" disabled selected value="none"></option> - <option value="checkbox">Checkbox</option> - <option value="email">Email</option> - <option value="number">Number</option> - <option value="radio">Radio</option> - <option value="range">Range</option> - <option value="slider">Slider</option> - <option value="textarea">Text (Block)</option> - <option value="text">Text (Line)</option> - </select> - </div> - </div> - </div> - - <div id="radio-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-primary uk-width-1-1" id="radio-add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="radio-add-input" class="uk-input" placeholder="Item"> - </div> - </div> - <div> - <div class="uk-form-label"> - <button type="button" class="uk-button uk-button-danger uk-width-1-1" id="radio-remove-button"><i class="uk-icon fa-fw far fa-minus"></i> Remove</button> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="radio-options"> - <option hidden="hidden" disabled selected value="none"></option> - </select> - </div> - </div> - </div> - - <div id="number-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number-min">Min Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="number-min" class="uk-input"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number-max">Max Value</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input type="text" id="number-max" class="uk-input"> - </div> - </div> - </div> - - <div id="existing-question-section" hidden="hidden"> - <br /> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="existing-question">Question</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <select class="uk-select" id="existing-question"> - <option hidden="hidden" disabled selected value="none"></option> - </select> - </div> - </div> - </div> - </form> - </div> - - <div class="uk-modal-footer"> - <div class="uk-text-center"> - <button class="uk-button uk-button-danger uk-modal-close" type="button" id="state-cancel"> - <i class="uk-icon fa-fw far fa-times"></i> Cancel - </button> - <button class="uk-button uk-button-primary" type="button" id="question-submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Save - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - const form = parseInt("{{ jam.number }}"); - const table_body = document.getElementById("table-body"); - const table = document.getElementById("table"); - const no_questions_paragraph = document.getElementById("no-questions-paragraph"); - - let all_questions = {{ question_ids | safe }}; - - const add_button = document.getElementById("add-button"); - const modal = UIkit.modal(document.getElementById("question-modal")); - - const question_source_section = document.getElementById("question-source-section"); - const question_source = document.getElementById("question-source"); - const loading_spinner = document.getElementById("loading-spinner"); - - const new_question_section = document.getElementById("new-question-section"); - const new_question_title = document.getElementById("new-question-title"); - const new_question_optional = document.getElementById("new-question-optional"); - const new_question_type = document.getElementById("new-question-type"); - - const radio_section = document.getElementById("radio-section"); - - const radio_add_button = document.getElementById("radio-add-button"); - const radio_add_input = document.getElementById("radio-add-input"); - const radio_remove_button = document.getElementById("radio-remove-button"); - const radio_options = document.getElementById("radio-options"); - - const number_section = document.getElementById("number-section"); - - const number_min = document.getElementById("number-min"); - const number_max = document.getElementById("number-max"); - - const existing_question_section = document.getElementById("existing-question-section"); - const existing_question_select = document.getElementById("existing-question"); - - const submit_button = document.getElementById("question-submit"); - - let current_radio_options = Array(); - - add_button.onclick = function() { - clearModal(); - checkModal(); - modal.show(); - }; - - question_source.onchange = function () { - checkModal(); - - if (this.value === "new") { - existing_question_section.setAttribute("hidden", "hidden"); - loading_spinner.setAttribute("hidden", "hidden"); - new_question_section.removeAttribute("hidden"); - } else { - new_question_section.setAttribute("hidden", "hidden"); - loading_spinner.removeAttribute("hidden"); - - actions.get_questions(function(result, data) { - existing_question_section.setAttribute("hidden", "hidden"); - loading_spinner.setAttribute("hidden", "hidden"); - - if (!result) { - UIkit.notification({ - "message": "Failed to fetch questions", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }) - } else { - existing_question_select.innerHTML = "<option hidden=\"hidden\" disabled selected value=\"none\"></option>"; - - for (let question of data.questions) { - let element = document.createElement("option"); - element.value = question.id; - element.text = question.title; - - existing_question_select.appendChild(element); - } - - existing_question_section.removeAttribute("hidden"); - } - }) - } - }; - - existing_question_select.onchange = function() { - if (all_questions.indexOf(existing_question_select.value) > -1) { - existing_question_select.classList.add("uk-form-danger"); - } else { - existing_question_select.classList.remove("uk-form-danger"); - } - - checkModal(); - }; - - new_question_type.onchange = function() { - if (this.value === "checkbox") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "email") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "number") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "radio") { - radio_section.removeAttribute("hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "range") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "slider") { - radio_section.setAttribute("hidden", "hidden"); - number_section.removeAttribute("hidden"); - } else if (this.value === "textarea") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else if (this.value === "text") { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } else { - radio_section.setAttribute("hidden", "hidden"); - number_section.setAttribute("hidden", "hidden"); - } - - checkModal(); - }; - - new_question_title.oninput = checkModal; - new_question_optional.onchange = checkModal; - - radio_add_input.onkeyup = function(event) { - event.preventDefault(); - - if (event.which === 13 || event.keyCode === 13) { - radio_add_button.onclick(undefined); - } - }; - - radio_add_button.onclick = function() { - let value = radio_add_input.value; - - if (value.length < 1) { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - let index = current_radio_options.indexOf(value); - - if (index > -1 || value === "none") { - radio_add_input.classList.add("uk-form-danger"); - radio_add_input.focus(); - } else { - radio_add_input.classList.remove("uk-form-danger"); - radio_add_input.value = ""; - - let element = document.createElement("option"); - element.value = value; - element.text = value; - - radio_options.appendChild(element); - current_radio_options.push(value); - } - } - - checkModal(); - }; - - radio_remove_button.onclick = function() { - let value = radio_options.value; - - if (value === "none") { - return; - } - - let index = current_radio_options.indexOf(value); - - if (index < 0) { // We have a problem! - console.log("Unable to remove value from radio values because it doesn't exist: " + value) - } else { - current_radio_options.splice(index, 1); - } - - for (let element of radio_options.getElementsByTagName("option")) { - if (element.value === "none") { - continue; - } - - if (element.value === value) { - radio_options.removeChild(element); - } - } - - radio_options.value = "none"; - radio_add_input.focus(); - checkModal(); - }; - - number_min.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkModal(); - }; - - number_max.oninput = function() { - if (this.value.length > 0 && isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger") - } else { - this.classList.remove("uk-form-danger") - } - - checkModal(); - }; - - submit_button.onclick = function () { - if (question_source.value === "existing") { - number_section.setAttribute("hidden", "hidden"); - existing_question_section.setAttribute("hidden", "hidden"); - new_question_section.setAttribute("hidden", "hidden"); - radio_section.setAttribute("hidden", "hidden"); - question_source_section.setAttribute("hidden", "hidden"); - loading_spinner.removeAttribute("hidden"); - - actions.associate_question(form, existing_question_select.value, function(result, data) { - if (result) { - addToTable(data.question); - modal.hide(); - clearModal(); - - UIkit.notification({ - "message": "Question added", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to add question to form", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } else { - let type = new_question_type.value; - let optional = new_question_optional.value === "optional"; - let title = new_question_title.value; - - let question_data = { - "type": type, - "optional": optional, - "title": title - }; - - if (type === "radio") { - question_data.data = {"options": current_radio_options}; - } else if (type === "number" - || type === "range" - || type === "slider") { - question_data.data = { - "max": parseInt(number_max.value), - "min": parseInt(number_min.value) - }; - } - - number_section.setAttribute("hidden", "hidden"); - existing_question_section.setAttribute("hidden", "hidden"); - new_question_section.setAttribute("hidden", "hidden"); - radio_section.setAttribute("hidden", "hidden"); - question_source_section.setAttribute("hidden", "hidden"); - loading_spinner.removeAttribute("hidden"); - - actions.create_question(question_data, function(result, data) { - if (result) { - actions.associate_question(form, data.id, function(result, data) { - modal.hide(); - clearModal(); - - if (result) { - addToTable(data.question); - - UIkit.notification({ - "message": "Question added", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Question created, but failed to associate with the form", - "status": "warning", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to create question", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } - }; - - const toTitleCase = (str) => str.replace(/\b\S/g, t => t.toUpperCase()); - - function hookUpDeleteButtons() { - for (let element of document.getElementsByClassName("delete-question-button")) { - element.onclick = function() { - let question_id = this.getAttribute("data-question-id"); - let row = document.getElementById("row-" + question_id); - - actions.disassociate_question(form, question_id, function(result, data) { - if (result) { - table_body.removeChild(row); - - let index = all_questions.indexOf(question_id); - - if (index < 0) { // We have a problem! - console.log("Unable to remove question from memory because it doesn't exist: " + question_id) - } else { - all_questions.splice(index, 1); - } - - if (all_questions.length < 1) { - table.setAttribute("hidden", "hidden"); - no_questions_paragraph.removeAttribute("hidden"); - } - - UIkit.notification({ - "message": "Question removed", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to remove question", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } - } - } - - function clearModal() { - // Question source section - question_source.value = "none"; - question_source_section.removeAttribute("hidden"); - - // Existing question section - loading_spinner.setAttribute("hidden", "hidden"); - - new_question_section.setAttribute("hidden", "hidden"); - - // New question section - new_question_title.value = ""; - new_question_optional.value = "none"; - new_question_type.value = "none"; - - // Radio question section - radio_section.setAttribute("hidden", "hidden"); - - radio_add_input.value = ""; - radio_options.innerHTML = "<option hidden=\"hidden\" disabled selected value=\"none\"></option>"; - radio_options.value = "none"; - - current_radio_options = Array(); - - // Number question section - number_section.setAttribute("hidden", "hidden"); - - existing_question_section.setAttribute("hidden", "hidden"); - - existing_question_select.innerHTML = "<option hidden=\"hidden\" disabled selected value=\"none\"></option>"; - existing_question_select.value = "none"; - } - - function checkModal() { - if (question_source.value === "none") { - return setButtonEnabled(false); - } else if (question_source.value === "new") { - if (new_question_title.value.length < 1) { - return setButtonEnabled(false); - } - - if (new_question_optional.value === "none") { - return setButtonEnabled(false); - } - - let question_type = new_question_type.value; - - if (question_type === "none") { - return setButtonEnabled(false); - } - - if (question_type === "radio") { - if (current_radio_options.length < 1) { - return setButtonEnabled(false); - } - } - - if ( question_type === "number" - || question_type === "range" - || question_type === "slider" - ) { - if (isNaN(parseInt(number_min.value))) { - return setButtonEnabled(false); - } - if (isNaN(parseInt(number_max.value))) { - return setButtonEnabled(false); - } - - if (number_min.value.length < 1 || number_max.value.length < 1) { - return setButtonEnabled(false); - } - } - } else { - if (existing_question_select.value === "none"){ - return setButtonEnabled(false); - } - - if (all_questions.indexOf(existing_question_select.value) > -1) { - return setButtonEnabled(false); - } - } - - return setButtonEnabled(true); - } - - function setButtonEnabled(enabled) { - submit_button.disabled = !enabled; - } - - function addToTable(question) { - console.log(question); - if (all_questions.indexOf(question.id) === -1) { - all_questions.push(question.id); - - let element = document.createElement("tr"); - element.id = "row-" + question.id; - element.innerHTML = getRowHTML(question); - - table_body.appendChild(element); - } - - if (all_questions.length > 0) { - table.removeAttribute("hidden"); - no_questions_paragraph.setAttribute("hidden", "hidden"); - } - hookUpDeleteButtons(); - } - - function getRowHTML(question) { - let optional; - let data; - - if (question.optional) { - optional = "<i class=\"uk-icon uk-text-success fa-fw far fa-check\"></i>" - } else { - optional = "<i class=\"uk-icon uk-text-danger fa-fw far fa-times\"></i>" - } - - if (question.type === "number" || question.type === "range" || question.type === "slider") { - data = ` -<i class="uk-icon fa-fw far fa-arrow-up" title="Max value"></i> ${question.data.max} -<br /> -<i class="uk-icon fa-fw far fa-arrow-down" title="Min value"></i> ${question.data.min} - ` - - } else if (question.type === "radio") { - data = "<ul>"; - - for (let option of question.data.options) { - data = data + `<li>${option}</li>` - } - data = data + "</ul>"; - } else { - data = "" - } - - let type = toTitleCase(question.type); - - const row = ` - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-question-button" data-question-id="${question.id}"><i class="uk-icon fa-fw far fa-times"></i></button> - </td> - <td class="uk-text-truncate" title="${question.id}">${question.id}</td> - <td class="uk-table-shrink">${optional}</td> - <td title="${question.title}">${question.title}</td> - <td class="uk-table-shrink" title="${type}">${type}</td> - <td>${data}</td> - `; - return row - } - - hookUpDeleteButtons(); - </script> -{% endblock %} diff --git a/templates/staff/jams/index.html b/templates/staff/jams/index.html deleted file mode 100644 index e4e1e242..00000000 --- a/templates/staff/jams/index.html +++ /dev/null @@ -1,252 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Code Jams{% endblock %} -{% block og_title %}Staff | Code Jams{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1>Code Jams</h1> - - <a class="uk-button uk-button-default" href="{{ url_for("staff.index") }}"><i class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - <a class="uk-button uk-button-secondary" href="{{ url_for("staff.jams.forms.questions") }}"><i class="uk-icon fa-fw far fa-list"></i> Questions</a> - <a class="uk-button uk-button-secondary" href="{{ url_for("staff.jams.infractions") }}"><i class="uk-icon fa-fw far fa-exclamation-triangle"></i> Infractions</a> - <a class="uk-button uk-button-primary" href="{{ url_for("staff.jams.create") }}"><i class="uk-icon fa-fw far fa-plus"></i> Create</a> - - {% if not jams %} - <p> - No code jams found. Create one above! - </p> - {% else %} - {% for jam in jams %} - <h2 class="uk-heading-divider"> - Code Jam {{ jam.number }}: {{ jam.title }} - - <span class="uk-align-right"> - {% if jam.state == "planning" %} - <i class="uk-icon uk-text-muted fa-fw far fa-edit state-{{ jam.number }}" title="State: Planning" id="state-{{ jam.number }}-planning"></i> - {% else %} - <i class="uk-icon uk-text-muted fa-fw far fa-edit state-{{ jam.number }}" hidden="hidden" title="State: Planning" id="state-{{ jam.number }}-planning"></i> - {% endif %} - - {% if jam.state == "announced" %} - <i class="uk-icon uk-text-primary fa-fw far fa-bullhorn state-{{ jam.number }}" title="State: Announced" id="state-{{ jam.number }}-announced"></i> - {% else %} - <i class="uk-icon uk-text-primary fa-fw far fa-bullhorn state-{{ jam.number }}" hidden="hidden" title="State: Announced" id="state-{{ jam.number }}-announced"></i> - {% endif %} - - {% if jam.state == "preparing" %} - <i class="uk-icon uk-text-muted fa-fw fal fa-ellipsis-h-alt state-{{ jam.number }}" title="State: Preparing" id="state-{{ jam.number }}-preparing"></i> - {% else %} - <i class="uk-icon uk-text-muted fa-fw fal fa-ellipsis-h-alt state-{{ jam.number }}" hidden="hidden" title="State: Preparing" id="state-{{ jam.number }}-preparing"></i> - {% endif %} - - {% if jam.state == "running" %} - <i class="uk-icon uk-text-success fa-fw far fa-play state-{{ jam.number }}" title="State: Running" id="state-{{ jam.number }}-running"></i> - {% else %} - <i class="uk-icon uk-text-success fa-fw far fa-play state-{{ jam.number }}" hidden="hidden" title="State: Running" id="state-{{ jam.number }}-running"></i> - {% endif %} - - {% if jam.state == "judging" %} - <i class="uk-icon uk-text-primary fa-fw far fa-balance-scale state-{{ jam.number }}" title="State: Judging" id="state-{{ jam.number }}-judging"></i> - {% else %} - <i class="uk-icon uk-text-primary fa-fw far fa-balance-scale state-{{ jam.number }}" hidden="hidden" title="State: Judging" id="state-{{ jam.number }}-judging"></i> - {% endif %} - - {% if jam.state == "finished" %} - <i class="uk-icon uk-text-success fa-fw far fa-check-square state-{{ jam.number }}" title="State: Finished" id="state-{{ jam.number }}-finished"></i> - {% else %} - <i class="uk-icon uk-text-success fa-fw far fa-check-square state-{{ jam.number }}" hidden="hidden" title="State: Finished" id="state-{{ jam.number }}-finished"></i> - {% endif %} - - {% if not jam.state in states %} - <i class="uk-icon uk-text-danger fa-fw far fa-question-square" title="Unknown state" id="state-{{ jam.number }}-unknown"></i> - {% else %} - <i class="uk-icon uk-text-danger fa-fw far fa-question-square" hidden="hidden" title="Unknown state" id="state-{{ jam.number }}-unknown"></i> - {% endif %} - </span> - </h2> - - <span class="uk-label">Participants: {{ jam.participants | length }}</span> - <span class="uk-label uk-label-success">Start: {{ format_datetime(jam.date_start) }} (UTC)</span> - <span class="uk-label uk-label-danger">End: {{ format_datetime(jam.date_end) }} (UTC)</span> - - <section class="uk-section"> - <div class="uk-button-group uk-width-1-1"> - <a class="uk-button uk-button-default uk-width-expand state-button" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-state"> - <i class="uk-icon fa-fw far fa-pencil"></i> State - </a> - - <a class="uk-button uk-button-default uk-width-expand" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-basics" href="{{ url_for("staff.jams.edit.basics", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-pencil"></i> Basics - </a> - - {% if jam.state in ["planning", "announced", "preparing", "finished"] %} - <a class="uk-button uk-button-default uk-width-expand" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-info" href="{{ url_for("staff.jams.edit.info", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-pencil"></i> Info - </a> - {% else %} - <a class="uk-button uk-button-default uk-width-expand" hidden="hidden" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-info" href="{{ url_for("staff.jams.edit.info", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-pencil"></i> Info - </a> - {% endif %} - - {% if jam.state in ["judging", "finished"] %} - <a class="uk-button uk-button-default uk-width-expand" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-ending" href="{{ url_for("staff.jams.edit.ending", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-pencil"></i> Ending - </a> - {% else %} - <a class="uk-button uk-button-default uk-width-expand" hidden="hidden" data-jam="{{ jam.number }}" id="jam-{{ jam.number }}-button-ending" href="{{ url_for("staff.jams.edit.ending", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-pencil"></i> Ending - </a> - {% endif %} - </div> - <br/> - <div class="uk-button-group uk-width-1-1"> - <a class="uk-button uk-button-danger uk-width-expand" href="{{ url_for("staff.jams.forms.view", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-list"></i> Form - </a> - <a class="uk-button uk-button-secondary uk-width-expand" href="{{ url_for("staff.jams.participants", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-user"></i> Participants - </a> - <a class="uk-button uk-button-primary uk-width-expand" href="{{ url_for("staff.jams.teams", jam=jam.number) }}"> - <i class="uk-icon fa-fw far fa-users"></i> Teams - </a> - </div> - </section> - {% endfor %} - {% endif %} - </div> - - <div id="state-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">Set State</h2> - </div> - - <div class="uk-modal-body"> - <form class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="state">State</label> - </div> - - <div class="uk-form-controls uk-form-controls-text"> - <select class="uk-select" name="state" id="state"> - {% for state in states %} - <option value="{{ state }}">{{ state.title() }}</option> - {% endfor %} - </select> - </div> - </div> - </form> - </div> - - <div class="uk-modal-footer"> - <div class="uk-text-center"> - <button class="uk-button uk-button-default uk-modal-close" type="button" id="state-cancel"> - <i class="uk-icon fa-fw far fa-arrow-left"></i> Cancel - </button> - <a class="uk-button uk-button-primary" type="button" id="state-submit"> - <i class="uk-icon fa-fw far fa-check"></i> Save - </a> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - - // State modal objects - const state_modal = UIkit.modal(document.getElementById("state-modal")); - const state_input = document.getElementById("state"); - const state_cancel = document.getElementById("state-cancel"); - const state_submit = document.getElementById("state-submit"); - - state_cancel.onclick = function() { - state_modal.hide(); - }; - - for (let button of document.getElementsByClassName("state-button")) { - button.onclick = function() { - state_modal.show(); - - state_submit.onclick = function() { - let jam = parseInt(button.getAttribute("data-jam")); - let state = state_input.value; - - actions.set_state(jam, state, function(success, data) { - if (success) { - UIkit.notification({ - "message": "State set successfully", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - - for (let icon of document.getElementsByClassName("state-" + jam)) { - icon.setAttribute("hidden", "hidden"); - } - - switch (state) { // Set the state on the page too so there's no reloading - case "planning": - document.getElementById("state-" + jam + "-planning").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").removeAttribute("hidden"); - document.getElementById("jam-" + jam + "-button-ending").setAttribute("hidden", "hidden"); - break; - case "announced": - document.getElementById("state-" + jam + "-announced").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").removeAttribute("hidden"); - document.getElementById("jam-" + jam + "-button-ending").setAttribute("hidden", "hidden"); - break; - case "preparing": - document.getElementById("state-" + jam + "-preparing").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").setAttribute("hidden", "hidden"); - document.getElementById("jam-" + jam + "-button-ending").setAttribute("hidden", "hidden"); - break; - case "running": - document.getElementById("state-" + jam + "-running").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").setAttribute("hidden", "hidden"); - document.getElementById("jam-" + jam + "-button-ending").setAttribute("hidden", "hidden"); - break; - case "judging": - document.getElementById("state-" + jam + "-judging").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").setAttribute("hidden", "hidden"); - document.getElementById("jam-" + jam + "-button-ending").removeAttribute("hidden"); - break; - case "finished": - document.getElementById("state-" + jam + "-finished").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").removeAttribute("hidden"); - document.getElementById("jam-" + jam + "-button-ending").removeAttribute("hidden"); - break; - default: - document.getElementById("state-" + jam + "-unknown").removeAttribute("hidden"); - - document.getElementById("jam-" + jam + "-button-info").setAttribute("hidden", "hidden"); - document.getElementById("jam-" + jam + "-button-ending").setAttribute("hidden", "hidden"); - break; - } - - state_modal.hide(); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to set state", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }) - } - }); - }; - } - } - </script> -{% endblock %}
\ No newline at end of file diff --git a/templates/staff/jams/infractions/view.html b/templates/staff/jams/infractions/view.html deleted file mode 100644 index a4391c53..00000000 --- a/templates/staff/jams/infractions/view.html +++ /dev/null @@ -1,328 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Infractions{% endblock %} -{% block og_title %}Staff | Jams | Infractions{% endblock %} -{% block og_description %}Manage infractions{% endblock %} -{% block content %} - <div class="uk-container uk-container-small uk-section"> - <h1>Infractions</h1> - - <a class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"><i class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - <button class="uk-button uk-button-primary" id="add-button"><i class="uk-icon fa-fw far fa-plus"></i> Add Infraction</button> - - {% if not infractions %} - <p id="no-infractions-paragraph">No infractions found.</p> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table" hidden="hidden"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th class="uk-table-shrink"><strong>ID</strong></th> - <th class="uk-table-shrink">Participant</th> - <th>Reason</th> - <th class="uk-table-shrink">Number</th> - </tr> - </thead> - <tbody id="table-body"> - </tbody> - </table> - {% else %} - <p id="no-infractions-paragraph" hidden="hidden">No questions found.</p> - - <div class="uk-overflow-auto"> - <br /> - <table class="uk-table uk-table-divider uk-table-striped uk-border" id="table"> - <thead> - <tr> - <th class="uk-table-shrink"> </th> - <th class="uk-table-shrink"><strong>ID</strong></th> - <th class="uk-table-shrink">Participant</th> - <th>Reason</th> - <th class="uk-table-shrink">Number</th> - </tr> - </thead> - <tbody id="table-body"> - {% for infraction in infractions %} - <tr id="row-{{ infraction.id }}"> - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-infraction-button" data-infraction-id="{{ infraction.id }}"><i class="uk-icon fa-fw far fa-trash"></i></button> - </td> - <td class="uk-text-truncate" title="{{ infraction.id }}">{{ infraction.id }}</td> - <td class="uk-table-shrink"> - {% if infraction.participant is not string %} - <code>{{ infraction.participant.user_id }}</code> - <br /> - ({{ infraction.participant.username }}#{{ infraction.participant.discriminator }}) - {% else %} - <code>{{ infraction.participant }}</code> - {% endif %} - </td> - <td title="{{ infraction.reason }}">{{ infraction.reason }}</td> - <td class="uk-table-shrink">{{ infraction.number }}</td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - {% endif %} - </div> - - <div id="add-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">Add Infraction</h2> - </div> - - <div class="uk-modal-body"> - <form class="uk-form-horizontal"> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="user-id">User ID</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input class="uk-input" id="user-id" name="user-id"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="reason">Reason</label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input class="uk-input" id="reason" name="reason"> - </div> - </div> - <div> - <div class="uk-form-label"> - <label class="uk-form-label" for="number"> - Number of jams - </label> - </div> - <div class="uk-form-controls-text uk-form-controls"> - <input class="uk-input" id="number" name="number" placeholder="Jams to ban for / -1 for infinite"> - </div> - </div> - <div id="loading-spinner" class="uk-text-center uk-margin-small-top" hidden="hidden"> - <div uk-spinner></div> - </div> - </form> - </div> - - <div class="uk-modal-footer"> - <div class="uk-text-center"> - <button class="uk-button uk-button-danger uk-modal-close" type="button" id="state-cancel"> - <i class="uk-icon fa-fw far fa-times"></i> Cancel - </button> - <button class="uk-button uk-button-primary" type="button" id="state-submit" disabled> - <i class="uk-icon fa-fw far fa-check"></i> Save - </button> - </div> - </div> - </div> - </div> - - <script type="application/javascript"> - "use strict"; - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - - const table_body = document.getElementById("table-body"); - const table = document.getElementById("table"); - const no_infractions_paragraph = document.getElementById("no-infractions-paragraph"); - - let all_infractions = {{ infraction_ids | safe }}; - - const add_button = document.getElementById("add-button"); - const modal = UIkit.modal(document.getElementById("add-modal")); - const loading_spinner = document.getElementById("loading-spinner"); - - const input_user_id = document.getElementById("user-id"); - const input_reason = document.getElementById("reason"); - const input_number = document.getElementById("number"); - - const submit_button = document.getElementById("state-submit"); - - add_button.onclick = function() { - clearModal(); - checkModal(); - modal.show(); - }; - - input_user_id.oninput = function() { - if (isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger"); - } else { - this.classList.remove("uk-form-danger"); - } - - checkModal(); - }; - - input_reason.oninput = function() { - checkModal(); - }; - - input_number.oninput = function() { - if (isNaN(parseInt(this.value))) { - this.classList.add("uk-form-danger"); - } else { - this.classList.remove("uk-form-danger"); - } - - checkModal(); - }; - - submit_button.onclick = function () { - loading_spinner.removeAttribute("hidden"); - - let user_id = input_user_id.value; - let reason = input_reason.value; - let number = input_number.value; - - actions.create_infraction(user_id, reason, number, function(result, data) { - if (result) { - let infraction = { - "id": data.id, - "participant": user_id, - "reason": reason, - "number": number - }; - - addToTable(infraction); - modal.hide(); - clearModal(); - - UIkit.notification({ - "message": "Infraction added", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to add infraction", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }); - }; - - function hookUpDeleteButtons() { - for (let element of document.getElementsByClassName("delete-infraction-button")) { - element.onclick = function() { - let infraction_id = this.getAttribute("data-infraction-id"); - let row = document.getElementById("row-" + infraction_id); - - actions.delete_infraction(infraction_id, function(result, data) { - if (result) { - table_body.removeChild(row); - - let index = all_infractions.indexOf(infraction_id); - - if (index < 0) { // We have a problem! - console.log("Unable to remove infraction from memory because it doesn't exist: " + infraction_id) - } else { - all_infractions.splice(index, 1); - } - - if (all_infractions.length < 1) { - table.setAttribute("hidden", "hidden"); - no_infractions_paragraph.removeAttribute("hidden"); - } - - UIkit.notification({ - "message": "Infraction removed", - "status": "success", - "pos": "bottom-center", - "timeout": 5000, - }); - } else { - console.log(data); - UIkit.notification({ - "message": "Failed to remove infraction", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000, - }); - } - }) - } - } - } - - function clearModal() { - - // Existing question section - loading_spinner.setAttribute("hidden", "hidden"); - - input_number.value = ""; - input_reason.value = ""; - input_user_id.value = ""; - } - - function checkModal() { - if (input_reason.value.length < 1 - || input_number.value.length < 1 - || input_user_id.value.length < 1) { - return setButtonEnabled(false); - } - - if (isNaN(parseInt(input_number.value))) { - return setButtonEnabled(false); - } - - if (isNaN(parseInt(input_user_id.value))) { - return setButtonEnabled(false); - } - - return setButtonEnabled(true); - } - - function setButtonEnabled(enabled) { - submit_button.disabled = !enabled; - } - - function addToTable(infraction) { - console.log(infraction); - if (all_infractions.indexOf(infraction.id) === -1) { - all_infractions.push(infraction.id); - - let element = document.createElement("tr"); - element.id = "row-" + infraction.id; - element.innerHTML = getRowHTML(infraction); - - table_body.appendChild(element); - } - - if (all_infractions.length > 0) { - table.removeAttribute("hidden"); - no_infractions_paragraph.setAttribute("hidden", "hidden"); - } - hookUpDeleteButtons(); - } - - function getRowHTML(infraction) { - let participant; - - if (typeof infraction.participant === 'string' || infraction.participant instanceof String) { - participant = infraction.participant; - } else { - participant = infraction.participant; - participant = `${participant.username}#${participant.discrminiator} (${participant.id})` - } - const row = ` - <td class="uk-table-shrink"> - <button class="uk-button-small uk-button uk-button-danger delete-infraction-button" data-infraction-id="${infraction.id}"><i class="uk-icon fa-fw far fa-trash"></i></button> - </td> - <td class="uk-text-truncate" title="${infraction.id}">${infraction.id}</td> - <td class="uk-table-shrink"><code>${participant}</code></td> - <td title="${infraction.reason}">${infraction.reason}</td> - <td class="uk-table-shrink">${infraction.number}</td> - `; - return row - } - - hookUpDeleteButtons(); - </script> -{% endblock %} diff --git a/templates/staff/jams/participants.html b/templates/staff/jams/participants.html deleted file mode 100644 index 726d407c..00000000 --- a/templates/staff/jams/participants.html +++ /dev/null @@ -1,163 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Participants{% endblock %} -{% block og_title %}Staff | Jams | Participants{% endblock %} -{% block og_description %}Listing of participant applications and their status{% endblock %} -{% block content %} - {% macro card_header(app) %} - <div> - <h2 class="uk-float-left"> - <i class="uk-icon fa-fw far fa-check status-icon" title="Approved"></i> - <i class="uk-icon fa-fw far fa-times status-icon" title="Not Approved"></i> - <img src="{{ app.avatar }}" height="20px" class="uk-border-circle" /> - {{ app.username }}#{{ app.discriminator }} - </h2> - <span class="uk-float-right"> - {% if jam.state in ["announced", "preparing"] %} - {% if app.approved %} - <button class="uk-button uk-button-success approve-button" data-app="{{ app.id }}" data-app-user="{{ app.username }}#{{ app.discriminator }}" id="approve-button-{{ app.id }}" disabled> - <i class="uk-icon fa-fw far fa-check"></i> - </button> - <button class="uk-button uk-button-danger unapprove-button" data-app="{{ app.id }}" data-app-user="{{ app.username }}#{{ app.discriminator }}" id="unapprove-button-{{ app.id }}"> - <i class="uk-icon fa-fw far fa-times"></i> - </button> - {% else %} - <button class="uk-button uk-button-success approve-button" data-app="{{ app.id }}" data-app-user="{{ app.username }}#{{ app.discriminator }}" id="approve-button-{{ app.id }}"> - <i class="uk-icon fa-fw far fa-check"></i> - </button> - <button class="uk-button uk-button-danger unapprove-button" data-app="{{ app.id }}" data-app-user="{{ app.username }}#{{ app.discriminator }}" id="unapprove-button-{{ app.id }}" disabled> - <i class="uk-icon fa-fw far fa-times"></i> - </button> - {% endif %} - {% endif %} - - <a class="uk-button uk-button-primary expand-button" data-app="{{ app.id }}" data-app-user="{{ app.username }}#{{ app.discriminator }}"> - <i class="uk-icon far fa-fw fa-plus expand-icon"></i> - <i class="uk-icon far fa-fw fa-minus contract-icon"></i> - </a> - </span> - </div> - {% endmacro %} - - <div class="uk-container uk-container-small uk-section"> - <h1 class="uk-text-center">Code Jam {{ jam.number }}: Participants</h1> - <a class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"><i class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - - <br /> - <br /> - - {% for app in jam.participants %} - <div class="uk-card approval-card collapsed" id="{{ app.id }}"> - {% if app.approved %} - <div class="uk-card-header approved" id="header-{{ app.id }}"> - {{ card_header(app) }} - </div> - {% else %} - <div class="uk-card-header unapproved" id="header-{{ app.id }}"> - {{ card_header(app) }} - </div> - {% endif %} - <div class="uk-card-body"> - <span class="uk-align-right user-id"> - <span class="uk-text-muted">User ID:</span> {{ app.user_id }} - </span> - - {% for response in app.answers %} - <div> - <strong>{{ questions[response.question].title }}</strong> - <br /> - <pre class="fira-code">{{ response.value }}</pre> - </div> - {% endfor %} - </div> - </div> - <br /> - {% endfor %} - </div> - - <script> - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - - for (let elem of document.getElementsByClassName("expand-button")) { - elem.onclick = function(result, data) { - let app = this.getAttribute("data-app"); - let card = document.getElementById(app); - - if (card.classList.contains("collapsed")) { - card.classList.remove("collapsed"); - } else { - card.classList.add("collapsed"); - } - } - } - - {% if jam.state in ["announced", "preparing"] %} - for (let elem of document.getElementsByClassName("approve-button")) { - elem.onclick = function() { - let app = this.getAttribute("data-app"); - let header = document.getElementById("header-" + app); - let unapprove_button = document.getElementById("unapprove-button-" + app); - let user = this.getAttribute("data-app-user"); - - actions.approve_application(app, function(result, data) { - if (!result) { - console.log(data); - return UIkit.notification({ - "message": "Approval failed", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - - header.classList.add("approved"); - header.classList.remove("unapproved"); - - elem.disabled = true; - unapprove_button.disabled = false; - - UIkit.notification({ - "message": "Approved: " + user, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - }); - } - } - - for (let elem of document.getElementsByClassName("unapprove-button")) { - elem.onclick = function() { - let app = this.getAttribute("data-app"); - let approve_button = document.getElementById("approve-button-" + app); - let header = document.getElementById("header-" + app); - let user = this.getAttribute("data-app-user"); - - actions.unapprove_application(app, function(result, data) { - if (!result) { - console.log(data); - return UIkit.notification({ - "message": "Unapproval failed", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - - header.classList.add("unapproved"); - header.classList.remove("approved"); - - elem.disabled = true; - approve_button.disabled = false; - - UIkit.notification({ - "message": "Unapproved: " + user, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - }); - } - } - {% endif %} - </script> -{% endblock %} diff --git a/templates/staff/jams/teams/view.html b/templates/staff/jams/teams/view.html deleted file mode 100644 index 659a60c2..00000000 --- a/templates/staff/jams/teams/view.html +++ /dev/null @@ -1,513 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Jams | Teams{% endblock %} -{% block og_title %}Staff | Jams | Teams{% endblock %} -{% block og_description %}Manage Teams{% endblock %} -{% block page_classes %}page-staff-jams-edit-teams{% endblock %} -{% block content %} - <div class="uk-flex"> - <div class="uk-flex-column uk-padding-small uk-background-muted" id="member-answers-sidebar"> - <h3 class="uk-text-center" id="user-info-hint">Hover a user to show their information here</h3> - - <div id="visible-user-info"> - - </div> - <div id="hidden-user-info" hidden> - {% for participant in jam.participants %} - <div class="user-info" id="user-info-{{ participant.user_id }}"> - <img src="{{ participant.avatar }}" class="uk-border-circle avatar"/> - <div class="uk-text-center"> - <strong>{{ participant.username }}#{{ participant.discriminator }}</strong> - </div> - <div class="uk-text-center"> - <span class="uk-text-muted">{{ participant.user_id }}</span> - </div> - <div class="uk-text-center"> - <i class="uk-icon far fa-fw fa-clock"></i> {{ participant.profile.timezone }} | - <a href="https://gitlab.com/{{ participant.profile.gitlab_username }}"> - <i class="uk-icon fab fa-fw fa-gitlab"></i> {{ participant.profile.gitlab_username }} - </a> - </div> - <hr class="uk-divider-icon"/> - - {% for answer in participant.answers %} - <strong>{{ questions[answer.question].title }}</strong> - <br/> - <span class="fira-code">{{ answer.value }}</span> - <br/> - <br/> - {% endfor %} - </div> - {% endfor %} - </div> - </div> - <div class="uk-section uk-flex-column uk-flex-stretch"> - <h1>Code Jam {{ jam.number }}: Teams</h1> - - <a class="uk-button uk-button-default" href="{{ url_for("staff.jams.index") }}"><i - class="uk-icon fa-fw far fa-arrow-left"></i> Back</a> - - {% if teams %} - <button class="uk-button uk-button-primary" id="init-button" disabled><i - class="uk-icon fa-fw far fa-play"></i> Generate Teams - </button> - {% else %} - <button class="uk-button uk-button-primary" id="init-button"><i class="uk-icon fa-fw far fa-play"></i> - Generate Teams - </button> - {% endif %} - - <button class="uk-button uk-button-secondary" id="add-button"><i class="uk-icon fa-fw far fa-plus"></i> - Add Team - </button> - - {% if jam.winning_team %} - <button class="uk-button team-winner-unset-button uk-button-secondary" id="winner-unset-button"><i - class="uk-icon fa-fw far fa-trophy"></i> - Unset Winner - </button> - {% else %} - <button class="uk-button team-winner-unset-button uk-hidden" id="winner-unset-button"><i - class="uk-icon fa-fw far fa-trophy"></i> - Unset Winner - </button> - {% endif %} - - <br/> - <br/> - <div class="uk-hidden hidden-participants" hidden> - {% for participant in jam.participants %} - {% if participant.user_id not in assigned %} - <div class="uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" - id="participant-line-{{ participant.user_id }}" title="{{ participant.user_id }}"> - <span class="participant-handle" draggable="true" data-user-id="{{ participant.user_id }}"> - <img class="uk-icon-image uk-border-circle" draggable="false" - src="{{ participant.avatar }}"/> - {{ participant.username }}#{{ participant.discriminator }} ({{ participant.profile.timezone }}) - </span> - </div> - {% endif %} - {% endfor %} - </div> - <div class="uk-flex uk-flex-row uk-flex-wrap" id="participant-handles"> - {% for participant in jam.participants %} - {% if participant.user_id not in assigned %} - <div class="participant-handle uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" - id="participant-{{ participant.user_id }}" - title="{{ participant.profile.timezone }} - {{ participant.user_id }}" draggable="true" - data-user-id="{{ participant.user_id }}"> - <div class="uk-card uk-card-primary uk-card-small" - id="participant-{{ participant.user_id }}-card"> - <div class="uk-card-body"> - <img class="uk-icon-image uk-border-circle" draggable="false" - src="{{ participant.avatar }}"/> - {{ participant.username }}#{{ participant.discriminator }} - </div> - </div> - </div> - {% else %} - <div class="participant-handle uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" - id="participant-{{ participant.user_id }}" - title="{{ participant.profile.timezone }} - {{ participant.user_id }}" draggable="true" - data-user-id="{{ participant.user_id }}"> - <div class="uk-card uk-card-secondary uk-card-small" - id="participant-{{ participant.user_id }}-card"> - <div class="uk-card-body"> - <img class="uk-icon-image uk-border-circle" draggable="false" - src="{{ participant.avatar }}"/> - {{ participant.username }}#{{ participant.discriminator }} - </div> - </div> - </div> - {% endif %} - {% endfor %} - </div> - - {% if not teams %} - <p id="no-teams-paragraph">No teams found.</p> - - <div class="uk-flex uk-flex-row uk-flex-stretch uk-flex-wrap uk-flex-center" id="team-targets"> - </div> - {% else %} - <p id="no-teams-paragraph" hidden="hidden">No teams found.</p> - - <div class="uk-flex uk-flex-row uk-flex-stretch uk-flex-wrap uk-flex-center" id="team-targets"> - {% for id, team in teams.items() %} - <div class="team-handle uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" - id="team-{{ team.id }}" data-team-id="{{ team.id }}"> - <div class="uk-card uk-card-default uk-card-small - {% if jam.winning_team and jam.winning_team == team.id %} - team-card-winner - {% endif %} - "> - <div class="uk-card-header"> - <h3 class="uk-card-title"> - {{ team.name }} - </h3> - </div> - <div class="uk-card-body team-target" data-team-id="{{ team.id }}"> - <p>Drop users here to assign them</p> - - {% for user_id in team.members %} - <div class="uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" - id="participant-line-{{ user_id }}" - title="{{ participants[user_id].user_id }}"> - <span class="participant-handle" draggable="true" - data-user-id="{{ participants[user_id].user_id }}"> - <img class="uk-icon-image uk-border-circle" draggable="false" - src="{{ participants[user_id].avatar }}"/> - {{ participants[user_id].username }}#{{ participants[user_id].discriminator }} ({{ participants[user_id].profile.timezone }}) - </span> - </div> - {% endfor %} - </div> - <div class="uk-card-footer uk-text-right"> - <button class="team-winner-button uk-button uk-button-small - {% if jam.winning_team %} - uk-hidden - {% endif %}" - data-team-id="{{ team.id }}"> - <i class="uk-icon fa-fw far fa-trophy"></i> - </button> - <button class="team-reroll-button uk-button uk-button-primary uk-button-small" - data-team-id="{{ team.id }}"> - <i class="uk-icon fa-fw far fa-dice"></i> - </button> - <button class="team-delete-button uk-button uk-button-danger uk-button-small" - data-team-id="{{ team.id }}"> - <i class="uk-icon fa-fw far fa-trash"></i> - </button> - </div> - </div> - </div> - {% endfor %} - </div> - {% endif %} - </div> - </div> - - <script type="application/javascript"> - "use strict"; - const jam = parseInt("{{ jam.number }}"); - const actions = new JamActions("{{ url_for("staff.jams.action") }}", "{{ csrf_token() }}"); - let jam_winning_team = "{{ jam.winning_tam or "" }}"; - const has_winner = function () { - return jam_winning_team !== ""; - }; - const set_winner_button = function (team) { - return ` - <button class="team-winner-button uk-button uk-button-small ${has_winner() ? "uk-hidden" : ""}" data-team-id="${team.id}"> - <i class="uk-icon fa-fw far fa-trophy"></i> - </button> - ` - }; - - $("#init-button").on( - "click", - () => actions.generate_teams(jam, (result, data) => { - if (result) { - data.teams.forEach((team) => { - let elem = ` - <div class="team-handle uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" id="team-${team.id}" data-team-id="${team.id}"> - <div class="uk-card uk-card-default uk-card-small"> - <div class="uk-card-header"> - <h3 class="uk-card-title">${team.name}</h3> - </div> - <div class="uk-card-body team-target" data-team-id="${team.id}"> - <p>Drop users here to assign them</p> - </div> - <div class="uk-card-footer uk-text-right"> - ${set_winner_button(team)} - <button class="team-reroll-button uk-button uk-button-primary uk-button-small" data-team-id="${team.id}"> - <i class="uk-icon fa-fw far fa-dice"></i> - </button> - <button class="team-delete-button uk-button uk-button-danger uk-button-small" data-team-id="${team.id}"> - <i class="uk-icon fa-fw far fa-trash"></i> - </button> - </div> - </div> - </div>`; - - $("#team-targets").append(elem); - assign_handlers(); - }); - - $("#init-button").prop('disabled', true); - - UIkit.notification({ - "message": `Generated ${data.teams.length} teams`, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - } else { - console.log(data); - - UIkit.notification({ - "message": "Failed to generate teams", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }) - ); - - $("#add-button").on( - "click", - () => actions.create_team(jam, (result, data) => { - if (result) { - let team = data.team; - let elem = ` - <div class="team-handle uk-margin-small-bottom uk-margin-small-right uk-margin-small-top uk-margin-small-left" id="team-${team.id}" data-team-id="${team.id}"> - <div class="uk-card uk-card-default uk-card-small"> - <div class="uk-card-header"> - <h3 class="uk-card-title">${team.name}</h3> - </div> - <div class="uk-card-body team-target" data-team-id="${team.id}"> - <p>Drop users here to assign them</p> - </div> - <div class="uk-card-footer uk-text-right"> - ${set_winner_button(team)} - <button class="team-reroll-button uk-button uk-button-primary uk-button-small" data-team-id="${team.id}"> - <i class="uk-icon fa-fw far fa-dice"></i> - </button> - <button class="team-delete-button uk-button uk-button-danger uk-button-small" data-team-id="${team.id}"> - <i class="uk-icon fa-fw far fa-trash"></i> - </button> - </div> - </div> - </div>`; - - $("#team-targets").append(elem); - assign_handlers(); - - UIkit.notification({ - "message": `Created team: ${team.name}`, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - } else { - console.log(data); - - UIkit.notification({ - "message": "Failed to create team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }) - ); - - function unset_winning_team(callback) { - actions.unset_winning_team(jam, (result, data) => { - if (result) { - $("#winner-unset-button").addClass("uk-hidden"); - $(".team-winner-button").removeClass("uk-hidden"); - $(".team-card-winner").removeClass("team-card-winner"); - UIkit.notification({ - "message": "Winning team unset", - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - jam_winning_team = ""; - if (callback) { - callback(true); - } - } else { - console.error(data); - UIkit.notification({ - "message": "Failed to unset winning team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - if (callback) { - callback(false); - } - } - }); - } - - $("#winner-unset-button").on( - "click", unset_winning_team - ); - - $(".participant-handle").on( - "dragstart", - (e) => { - e.originalEvent.dataTransfer.setData( - "pydis/member", - e.target.getAttribute("data-user-id") - ); - } - ).on( - "mouseenter", - (e) => { - $("#user-info-hint").prop("hidden", true); - $(".user-info").appendTo("#hidden-user-info"); - - console.log(e.target); - let target = e.target; - let member = target.getAttribute("data-user-id"); - - if (member === null) { - target = e.target.parentNode.parentNode; - member = target.getAttribute("data-user-id"); - } - - console.log(member); - - $(`#user-info-${member}`).appendTo("#visible-user-info"); - } - ); - - function drag_over(e) { - e.preventDefault(); - e.stopPropagation(); - - e.originalEvent.dropEffect = "move"; - } - - function drop(e) { - e.preventDefault(); - e.stopPropagation(); - - let member = e.originalEvent.dataTransfer.getData("pydis/member"); - - if (!member) { - return; - } - - let target = e.target; - - if (target.tagName === "p" || target.tagName === "P") { - target = target.parentNode; - } - - let team = target.getAttribute("data-team-id"); - - $(`#participant-line-${member}`).appendTo(target); - actions.set_team_member(jam, member, team, (result, data) => { - if (result) { - UIkit.notification({ - "message": `Team assigned successfully`, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - - $(`#participant-${member}-card`).removeClass("uk-card-primary").addClass("uk-card-secondary"); - } else { - console.log(data); - - UIkit.notification({ - "message": "Failed to assign user to team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }); - } - - function set_winning_team(e) { - let team = this.getAttribute("data-team-id"); - - actions.set_winning_team(team, (result, data) => { - if (result) { - $(".team-winner-button").addClass("uk-hidden"); - $("#winner-unset-button").removeClass("uk-hidden"); - $(".team-card-winner").removeClass("team-card-winner"); - $(`#team-${team}`).find(".uk-card").addClass("team-card-winner"); - UIkit.notification({ - "message": "Winning team updated", - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - jam_winning_team = team; - } else { - console.error(data); - UIkit.notification({ - "message": "Failed to set winning team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }); - } - - function reroll_team(e) { - let team = this.getAttribute("data-team-id"); - - actions.reroll_team(team, (result, data) => { - if (result) { - $(`#team-${team}`).find("h3").text(data.name); - - UIkit.notification({ - "message": `Team rerolled: ${data.name}`, - "status": "success", - "pos": "bottom-center", - "timeout": 5000 - }); - } else { - console.log(data); - - UIkit.notification({ - "message": "Failed to reroll team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }) - } - - function delete_team(e) { - let team = this.getAttribute("data-team-id"); - const perform = () => { - actions.delete_team(team, (result, data) => { - if (result) { - let target = $(`#team-${team}`); - - target.find(".team-target").children("div").appendTo(".hidden-participants"); - target.remove(); - } else { - console.log(data); - - UIkit.notification({ - "message": "Failed to delete team", - "status": "danger", - "pos": "bottom-center", - "timeout": 5000 - }); - } - }) - }; - - if (jam_winning_team === team) { - // unset the winning team first - unset_winning_team(result => { - if (result) { - perform(); - } - }); - } else { - perform(); - } - } - - function assign_handlers() { - $(".team-target").off("dragover").off("drop").on("dragover", drag_over).on("drop", drop); - $(".team-winner-button").off("click").on("click", set_winning_team); - $(".team-reroll-button").off("click").on("click", reroll_team); - $(".team-delete-button").off("click").on("click", delete_team); - } - - assign_handlers(); - </script> -{% endblock %} diff --git a/templates/staff/tables/edit.html b/templates/staff/tables/edit.html deleted file mode 100644 index b3b9faae..00000000 --- a/templates/staff/tables/edit.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Home{% endblock %} -{% block og_title %}Staff | Home{% endblock %} -{% block og_description %}Landing page for the staff management area{% endblock %} -{% block content %} - <div class="uk-container uk-section uk-container-small"> - {% if message %} - <div class="uk-alert uk-alert-warning"> - {{ message }} - </div> - {% endif %} - <form uk-grid class="uk-grid-small" action="{{ url_for("staff.tables.edit", table=table) }}" method="post"> - <div class="uk-width-expand"> - <p>Primary key: <strong>"<span class="fira-code">{{ primary_key }}</span>"</strong></p> - </div> - <div class="uk-width-auto"> - <a class="uk-button uk-button-default" href="{{ url_for("staff.tables.table", table=table, page=1) }}"><i class="uk-icon fa-fw fas fa-arrow-left"></i> Back</a> - <input class="uk-button uk-button-primary" type="submit" id="submit" value="Save" /> - </div> - <div class="uk-width-1-1"> - <div id="editor" class="uk-textarea">{{ document }}</div> - <input type="hidden" name="json" id="json" /> - </div> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - - {% if old_primary %} - <input type="hidden" name="old_primary" value="{{ old_primary }}"/> - {% endif %} - </form> - - <script type="application/javascript"> - "use strict"; - - window.onload = () => { - let editor = ace.edit("editor"); - - editor.session.setMode("ace/mode/json"); - editor.session.setUseWrapMode(true); - - editor.setTheme("ace/theme/iplastic"); - editor.setShowPrintMargin(false); - - editor.on("input", function () { - document.getElementById("json").value = editor.getValue(); - }); - }; - </script> - </div> -{% endblock %} diff --git a/templates/staff/tables/index.html b/templates/staff/tables/index.html deleted file mode 100644 index 206234bb..00000000 --- a/templates/staff/tables/index.html +++ /dev/null @@ -1,32 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Tables{% endblock %} -{% block og_title %}Staff | Tables{% endblock %} -{% block og_description %}Table management and editor{% endblock %} -{% block content %} - <div class="uk-container uk-section uk-container-small"> - <a class="uk-button uk-button-default" href="{{ url_for("staff.index") }}"><i class="uk-icon fa-fw fas fa-arrow-left"></i> Back</a> - <h1 class="uk-title uk-text-center"> - Table manager - </h1> - <p> - Click one of the tables below to manage its data: - </p> - <ul> - {% for table, obj in tables.items() %} - {% if obj.locked %} - <li> - <a href="{{ url_for("staff.tables.table", table=table, page=1) }}" title="Table locked for editing"> - <i class="uk-icon fa-fw fas fa-lock"></i> {{ table }} - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("staff.tables.table", table=table, page=1) }}"> - <i class="uk-icon fa-fw fas fa-pencil"></i> {{ table }} - </a> - </li> - {% endif %} - {% endfor %} - </ul> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/staff/tables/table.html b/templates/staff/tables/table.html deleted file mode 100644 index 87d981a0..00000000 --- a/templates/staff/tables/table.html +++ /dev/null @@ -1,165 +0,0 @@ -{% extends "main/base.html" %} -{% block title %}Staff | Home{% endblock %} -{% block og_title %}Staff | Home{% endblock %} -{% block og_description %}Landing page for the staff management area{% endblock %} -{% block content %} - <div class="uk-container uk-section uk-container-small"> - <a class="uk-button uk-button-default" href="{{ url_for("staff.tables.index") }}"><i class="uk-icon fa-fw fas fa-arrow-left"></i> Back</a> - - {% if page == "all" %} - <a class="uk-button uk-button-dark" href="{{ url_for("staff.tables.table", table=table, page=1) }}"><i class="uk-icon fa-fw fas fa-bars"></i> Page 1</a> - {% else %} - <a class="uk-button uk-button-dark" href="{{ url_for("staff.tables.table", table=table, page="all") }}"><i class="uk-icon fa-fw fas fa-bars"></i> All Data</a> - {% endif %} - - {% if not table_obj.locked %} - <a class="uk-button uk-button-primary" href="{{ url_for("staff.tables.edit", table=table) }}"><i class="uk-icon fa-fw fas fa-plus"></i> Add</a> - {% endif %} - - <h1 class="uk-title uk-text-center"> - <span class="fira-code"> - {{ table }} - - {% if table_obj.locked %} - <i class="uk-icon fa-fw fas fa-lock" title="Table locked for editing"></i> - {% endif %} - </span> - </h1> - - <form action="{{ url_for("staff.tables.table", table=table, page="all") }}" method="get" class="uk-width-1-1"> - <div class="uk-form-custom uk-width-1-1 uk-flex"> - {% if search %} - <input class="uk-input uk-width-expand" name="search" type="text" placeholder="Search (RE2)" value="{{ search }}" /> - {% else %} - <input class="uk-input uk-width-expand" name="search" type="text" placeholder="Search (RE2)" /> - {% endif %} - - <div class="uk-width-auto uk-flex-auto"> - <select class="uk-select uk-width-1-1" name="search-key" title="Table Key"> - <option class="uk-text-bold">{{ table_obj.primary_key }}</option> - {% for key in table_obj.keys %} - {% if key != table_obj.primary_key %} - {% if search_key == key %} - <option selected>{{ key }}</option> - {% else %} - <option>{{ key }}</option> - {% endif %} - {% endif %} - {% endfor %} - </select> - </div> - - <button class="uk-button uk-button-primary uk-width-auto" type="submit"><i class="uk-icon fas fa-search"></i></button> - <a class="uk-button uk-button-dark uk-width-auto" target="_blank" href="https://github.com/google/re2/wiki/Syntax"><i class="uk-icon fas fa-question-circle"></i></a> - </div> - </form> - - {% macro paginate() %} - {% if pages != "all" %} - <ul class="uk-pagination uk-flex-center" uk-margin> - {% if page > 1 %} - <li><a href="{{ url_for("staff.tables.table", table=table, page=page - 1) }}"><span uk-pagination-previous></span></a></li> - {% else %} - <li class="uk-disabled"><a><span uk-pagination-previous></span></a></li> - {% endif %} - - {% if page == 1 %} - <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=1) }}">1</a></li> - {% else %} - <li><a href="{{ url_for("staff.tables.table", table=table, page=1) }}">1</a></li> - {% endif %} - - {% if page >= 5 %} - <li class="uk-disabled"><a>...</a></li> - {% endif %} - - {% set current_page = page - 2 %} - - {% for num in range(5) %} - {% if current_page + num > 1 and current_page + num < pages %} - {% if current_page + num == page %} - <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=current_page + num) }}">{{ current_page + num }}</a></li> - {% else %} - <li><a href="{{ url_for("staff.tables.table", table=table, page=current_page + num) }}">{{ current_page + num }}</a></li> - {% endif %} - {% endif %} - {% set current_page = current_page - 1 %} - {% endfor %} - - {% if pages - page > 3 %} - <li class="uk-disabled"><a>...</a></li> - {% endif %} - - {% if pages != 1 %} - {% if page == pages %} - <li class="uk-active"><a href="{{ url_for("staff.tables.table", table=table, page=pages) }}">{{ pages }}</a></li> - {% else %} - <li><a href="{{ url_for("staff.tables.table", table=table, page=pages) }}">{{ pages }}</a></li> - {% endif %} - {% endif %} - - {% if page < pages %} - <li><a href="{{ url_for("staff.tables.table", table=table, page=page + 1) }}"><span uk-pagination-next></span></a></li> - {% else %} - <li class="uk-disabled"><a><span uk-pagination-next></span></a></li> - {% endif %} - </ul> - {% endif %} - {% endmacro %} - - {{ paginate() }} - - </div> - <div class="uk-container uk-section"> - {% if documents %} - <table class="uk-table uk-table-striped uk-overflow-auto"> - <thead> - <tr> - {% if not table_obj.locked %} - <th class="uk-table-shrink uk-text-center"> - <i class="uk-icon fa-fw fas fa-pencil"></i> - </th> - {% endif %} - - {% for key in table_obj.keys %} - <th title="{{ key }}"> - {% if key == table_obj.primary_key %} - <strong>{{ key }}</strong> - {% else %} - {{ key }} - {% endif %} - </th> - {% endfor %} - </tr> - </thead> - <tbody> - {% for doc in documents %} - <tr> - {% if not table_obj.locked %} - <td class="uk-table-shrink"> - <a href="{{ url_for("staff.tables.edit", table=table, key=doc[table_obj.primary_key]) }}"> - <i class="uk-icon fa-fw fas fa-pencil"></i> - </a> - </td> - {% endif %} - - {% for key in table_obj.keys %} - <td class="uk-text-truncate fira-code" title="{{ doc[key] }}"> - {% if key == table_obj.primary_key %} - <strong>{{ doc[key] }}</strong> - {% else %} - {{ doc[key] }} - {% endif %} - </td> - {% endfor %} - </tr> - {% endfor %} - </tbody> - </table> - {% else %} - <p class="uk-text-center">No documents found</p> - {% endif %} - - {{ paginate() }} - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/base.html b/templates/wiki/base.html deleted file mode 100644 index 038ee5a2..00000000 --- a/templates/wiki/base.html +++ /dev/null @@ -1,216 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - {% block head %} - <title>Python Discord | {% block title %}{% endblock %}</title> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <script src="{{ static_file('js/script.js') }}" type="application/javascript"></script> - - <!-- Static stuff --> - <link rel="shortcut icon" href="{{ static_file('favicon.ico') }}"> - <link rel="stylesheet" href="{{ static_file('css/uikit_blurple.css') }}"/> - <link rel="stylesheet" href="{{ static_file('css/style.css') }}"/> - <link rel="stylesheet" href="{{ static_file('css/bundled/pygments-monokai.css') }}"/> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> - - <!-- OpenGraph metadata --> - <meta property="og:title" content="Python Discord | {% block og_title %}{% endblock %}"> - <meta property="og:description" content="{% block og_description %}We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.{% endblock %}"> - <meta content="/static/logos/logo_discord.png" property="og:image"> - {% endblock %} - {% block extra_head %} - - {% endblock %} - </head> - <body class="{% block page_classes %}{% endblock page_classes %} - page-{{ current_page.replace(".", "-") }} - blueprint-{{ blueprint.replace(".", "-") }}"> - <div class="uk-offcanvas-content uk-flex uk-flex-column" id="wiki-page"> - {% include "main/navigation.html" %} - <div class="uk-flex uk-flex-row uk-flex-1"> - <div class="uk-card uk-card-body uk-flex-left uk-flex uk-card-primary uk-visible@s" id="wiki-sidebar"> - <ul class="uk-nav-default uk-nav-parent-icon" uk-nav id="wiki-nav"> - {% if data is defined and current_page == "wiki.page" %} - {% if "headers" in data and data.headers %} - <li class="uk-nav-header">Contents</li> - {% for header in data.headers %} - {% if "sub_headers" in header %} - <li class="uk-parent"> - <a href="{{ header.id }}"> - {{ header.title | safe }} - </a> - <ul class="uk-nav-sub"> - {% for sub in header.sub_headers %} - <li><a href="{{ sub.id }}"> - {{ sub.title | safe }} - </a></li> - {% endfor %} - </ul> - </li> - {% else %} - <li><a href="{{ header.id }}">{{ header.title | safe }}</a></li> - {% endif %} - {% endfor %} - <li class="uk-nav-divider"></li> - {% endif %} - {% endif %} - <li class="uk-nav-header">Pages</li> - - <li><a href="{{ url_for("wiki.page", page="home") }}"> - <i class="uk-icon fas fa-fw fa-home"></i> Home - </a></li> - <li><a href="{{ url_for("wiki.page", page="jams") }}"> - <i class="uk-icon fas fa-fw fa-star-exclamation"></i> Code Jams</a> - </li> - <li><a href="{{ url_for("wiki.page", page="contributing") }}"> - <i class="uk-icon fas fa-fw fa-code-branch"></i> Contributing - </a></li> - - {% set ACTIONABLE_PAGES = [ - "wiki.page", "wiki.edit", "wiki.history.show", - "wiki.history.compare", "wiki.source", "wiki.delete", - "wiki.move" - ] %} - {% set actionable = current_page in ACTIONABLE_PAGES and can_edit %} - - {% if actionable %} - <li class="uk-nav-divider"></li> - - <li class="uk-nav-header">Actions</li> - - {% if current_page == "wiki.edit" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.edit", page=page) }}"> - <i class="uk-icon fas fa-fw fa-pencil-alt"></i> Edit - </a> - </li> - {% endif %} - - {% if current_page == "wiki.delete" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.delete", page=page) }}"> - <i class="uk-icon fas fa-fw fa-trash"></i> Delete - </a> - </li> - {% endif %} - - {% if current_page == "wiki.move" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.move", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-right"></i> Move - </a> - </li> - {% endif %} - - {% if current_page == "wiki.history.show" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% elif current_page == "wiki.history.compare" %} - <li> - <a href="{{ url_for("wiki.history.show", page=slug) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.history.show", page=page) }}"> - <i class="uk-icon fas fa-fw fa-history"></i> Revisions - </a> - </li> - {% endif %} - - {% if current_page == "wiki.source" %} - <li> - <a href="{{ url_for("wiki.page", page=page) }}"> - <i class="uk-icon fas fa-fw fa-arrow-left"></i> Back - </a> - </li> - {% else %} - <li> - <a href="{{ url_for("wiki.source", page=page) }}"> - <i class="uk-icon fas fa-fw fa-code"></i> Source - </a> - </li> - {% endif %} - {% endif %} - - <li class="uk-nav-divider"></li> - <li class="uk-nav-header">Information</li> - - <li><a href="{{ url_for("wiki.special") }}"> - <i class="uk-icon fas fa-fw fa-ellipsis-h"></i> Special Pages - </a></li> - <li><a href="{{ url_for("wiki.page", page="help") }}"> - <i class="uk-icon fas fa-fw fa-question-circle"></i> Help - </a></li> - - <li> - <form action="{{ url_for("wiki.search") }}" method="post"> - {% if query is undefined %} - <input type="text" class="uk-input sidebar-search-input" placeholder="Search (BETA)" id="query" name="query" required> - {% else %} - <input type="text" class="uk-input sidebar-search-input" placeholder="Search (BETA)" id="query" name="query" value="{{ query }}" required> - {% endif %} - <br /> - <button class="uk-button uk-button-darkish uk-button-small search-button" type="submit" id="search" title="Search"> - <i class="uk-icon fas fa-fw fa-search"></i> - </button> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - </li> - </ul> - </div> - <div class="uk-width-expand full-width"> - <a class="uk-flex-left uk-flex uk-flex-column uk-background-primary uk-hidden@s uk-hidden@m uk-hidden@l uk-hidden@xl" id="wiki-sidebar-button"> - <div class="uk-flex-center"><i class="uk-icon fa-fw far fa-bars"></i></div> - </a> - <div class="uk-section uk-flex uk-flex-column content"> - {% block content %}{% endblock %} - </div> - </div> - </div> - </div> - - <footer> - <div class="uk-section uk-section-secondary uk-container-medium uk-text-meta"> - <div class="uk-text-center uk-text-meta"> - <p> - This website uses <a href="https://python.org">Python</a> and - <a href="http://flask.pocoo.org/">Flask</a>, and was developed collaboratively on - <a href="https://gitlab.com/python-discord/projects/site">GitLab</a>. - <br /> - For privacy & GDPR-related info, please <a href="{{ url_for("main.about.privacy") }}">see this page</a>. - </p> - </div> - </div> - </footer> - - <script> - wiki_sidebar(); - </script> - </body> -</html> diff --git a/templates/wiki/compare_revision.html b/templates/wiki/compare_revision.html deleted file mode 100644 index 34ab61bc..00000000 --- a/templates/wiki/compare_revision.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Comparing {{ title }}{% endblock %} -{% block og_title %}Wiki | Comparing {{ title }}{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <h2 class="uk-title"> - Revision comparison for {{ title }} - </h2> - - {{ diff | safe }} - </div> -{% endblock %} diff --git a/templates/wiki/page_delete.html b/templates/wiki/page_delete.html deleted file mode 100644 index 27c4b406..00000000 --- a/templates/wiki/page_delete.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Delete: {{ page }}{% endblock %} -{% block og_title %}Wiki | Delete: {{ page }}{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <div uk-alert class="uk-alert-danger"> - <h3>Delete Page: {{ page }}</h3> - <p> - Are you sure you want to delete this page? - </p> - - <form uk-grid class="uk-grid-small" action="{{ url_for("wiki.delete", page=page) }}" method="post"> - <div class="uk-width-1-2"> - <a href="{{ url_for("wiki.page", page=page) }}" class="uk-button uk-button-primary uk-width-1-1" type="button" id="cancel">Cancel</a> - </div> - <div class="uk-width-1-2"> - <input class="uk-button uk-button-secondary uk-width-1-1" type="submit" id="delete" value="Delete" /> - </div> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - </div> - </div> -{% endblock %} diff --git a/templates/wiki/page_edit.html b/templates/wiki/page_edit.html deleted file mode 100644 index 7293b5f5..00000000 --- a/templates/wiki/page_edit.html +++ /dev/null @@ -1,137 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Edit: {{ page }}{% endblock %} -{% block og_title %}Wiki | Edit: {{ page }}{% endblock %} -{% block og_description %}{% endblock %} - -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <form uk-grid class="uk-grid-small" action="{{ url_for("wiki.edit", page=page) }}" method="post"> - <div class="uk-width-expand"> - <input name="title" id="title" placeholder="Page Title" value="{{ title }}" class="uk-input" required /> - </div> - <div class="uk-width-auto"> - <button class="uk-button uk-button-secondary" type="button" value="Preview" id="preview">Preview</button> - </div> - <div class="uk-width-auto"> - <input class="uk-button uk-button-primary" type="submit" id="submit" value="Save" disabled /> - </div> - <div class="uk-width-1-1"> - <div id="editor" class="uk-textarea">{{ rst }}</div> - <input type="hidden" name="rst" id="rst" /> - </div> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - - <div class="uk-container uk-container-small preview-title"> - <h2 id="preview-title">{{ title }}</h2> - - <div id="preview-div"> - {{ preview | safe }} - </div> - </div> - - <script type="application/javascript"> - "use strict"; - - window.onload = () => { - let csrf_token = "{{ csrf_token() }}"; - - function do_preview(_) { - let oReq = new XMLHttpRequest(); - - oReq.addEventListener("load", function () { - let response = JSON.parse(this.responseText); - - if (response.error !== undefined) { - document.getElementById("submit").disabled = true; - - if (response.error_lines !== undefined) { - editor.session.setAnnotations(response.error_lines); - document.getElementById("preview-div").innerHTML = "<h3>Error - see editor margin</h3>"; - } else { - console.log("Error: " + response.error); - document.getElementById("preview-div").innerHTML = "<h3>Error</h3><p>" + response.error + "<p>"; - } - } else { - document.getElementById("submit").disabled = false; - document.getElementById("preview-div").innerHTML = response.data; - - editor.session.setAnnotations([]); - } - }); - - let data = editor.getValue(); - - if (data.replace("\s", "").length < 1 || document.getElementById("title").value.length < 1) { - document.getElementById("submit").disabled = true; - return false; - } - - oReq.open("POST", "/render"); - - oReq.setRequestHeader("Content-type", "application/json"); - oReq.setRequestHeader("X-CSRFToken", csrf_token); - - oReq.send(JSON.stringify({"data": editor.getValue()})); - - return false; - } - - document.getElementById("preview").onclick = do_preview; - - let editor = ace.edit("editor"); - let timer; - - editor.session.setMode("ace/mode/rst"); - editor.session.setUseWrapMode(true); - - editor.setTheme("ace/theme/iplastic"); - editor.setShowPrintMargin(false); - - editor.on("input", function () { - document.getElementById("submit").disabled = true; - document.getElementById("rst").value = editor.getValue(); - - if (timer !== undefined) { - clearTimeout(timer); - } - timer = setTimeout(do_preview, 1000); - }); - - document.getElementById("title").oninput = function () { - if (document.getElementById("title").value.length < 1) { - document.getElementById("submit").disabled = true; - } - - document.getElementById("preview-title").textContent = document.getElementById("title").value; - - document.getElementById("rst").value = editor.getValue(); - - if (timer !== undefined) { - clearTimeout(timer); - } - timer = setTimeout(do_preview, 1000); - }; - - function refreshLock() { - console.log("Refreshing lock"); - let xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function () { - if (this.readyState === 4 && this.status === 204) { - console.log("Lock refreshed") - } else if (this.readyState === 4 && this.status !== 204) { - console.log("Could not refresh lock") - } - }; - - xhttp.open("PATCH", document.location.pathname, true); - xhttp.send(); - } - - // Lock refreshing - setInterval(refreshLock, (60 * 4) * 1000); - } - </script> -{% endblock %} diff --git a/templates/wiki/page_in_use.html b/templates/wiki/page_in_use.html deleted file mode 100644 index 1707845c..00000000 --- a/templates/wiki/page_in_use.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki Error{% endblock %} -{% block og_title %}Wiki Error{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <div uk-alert class="uk-alert-warning"> - <h3>The page you requested is currently being edited</h3> - <p>Please try again in a little bit when the lock has expired.</p> - </div> - </div> -{% endblock %} diff --git a/templates/wiki/page_move.html b/templates/wiki/page_move.html deleted file mode 100644 index 2bd772e9..00000000 --- a/templates/wiki/page_move.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Move: {{ page }}{% endblock %} -{% block og_title %}Wiki | Move: {{ page }}{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - {% if message is defined %} - <div uk-alert class="uk-alert-danger"> - <p>{{ message }}</p> - </div> - {% endif %} - - <h3>Move Page: {{ page }}</h3> - <form uk-grid class="uk-grid-small" action="{{ url_for("wiki.move", page=page) }}" method="post"> - <input type="text" class="uk-width-1-1 uk-input location-input" placeholder="{{ page }}" id="location" name="location" required> - <div class="uk-width-1-2"> - <a href="{{ url_for("wiki.page", page=page) }}" class="uk-button uk-button-secondary uk-width-1-1" type="button" id="cancel">Cancel</a> - </div> - <div class="uk-width-1-2"> - <input class="uk-button uk-button-primary uk-width-1-1" type="submit" id="move" value="Move" /> - </div> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - </div> -{% endblock %} diff --git a/templates/wiki/page_source.html b/templates/wiki/page_source.html deleted file mode 100644 index 15384aa9..00000000 --- a/templates/wiki/page_source.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | {{ data["title"] }}{% endblock %} -{% block og_title %}Wiki | {{ data["title"] }}{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <h2 class="uk-title"> - {{ data["title"] }} - </h2> - - {{ rst | safe }} - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/page_view.html b/templates/wiki/page_view.html deleted file mode 100644 index aa560390..00000000 --- a/templates/wiki/page_view.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | {{ data["title"] }}{% endblock %} -{% block og_title %}Wiki | {{ data["title"] }}{% endblock %} - -{# To be safe about whitespace formatting on various platforms, we do everything one one line here #} -{% block og_description %}{% if data.rst.startswith(".. header::") %}{{ data.text.split("\n", 1)[0] }}{% endif %}{% endblock %} - -{% block page_classes %}uses-rst{% endblock %} - -{% block content %} - <div class="uk-container uk-container-small" id="doc-view"> - <h2 class="uk-title"> - {{ data["title"] }} - </h2> - - {{ data["html"] | safe }} - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/revision_list.html b/templates/wiki/revision_list.html deleted file mode 100644 index cd6767db..00000000 --- a/templates/wiki/revision_list.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Revisions to {{ page }}{% endblock %} -{% block og_title %}Wiki | Revisions to {{ page }}{% endblock %} -{% block og_description %}{% endblock %} -{% block content %} - <div class="uk-container"> - <h2>Wiki page revisions</h2> - <table class="uk-table uk-table-hover"> - <thead> - <tr> - <th>Page title</th> - <th>Date</th> - <th>User ID</th> - <th>Compare before</th> - <th>Compare after</th> - </tr> - </thead> - <tbody> - {% for revision in revisions %} - <tr> - <td>{{ revision["post"]["title"] }}</td> - <td>{{ revision["pretty_time"] }}</td> - <td>{{ revision['user'] }}</td> - <td><input type="radio" id="compare-before-{{ revision['id'] }}" class="uk-radio"></td> - <td><input type="radio" id="compare-after-{{ revision['id'] }}" class="uk-radio"></td> - </tr> - {% endfor %} - </tbody> - </table> - <a href="#" id="compare-submit" class="uk-button uk-button-primary">Compare selections</a> - </div> - <script> - let revisions = {{ revisions | tojson }}; - revision_diff(revisions); - </script> -{% endblock %} diff --git a/templates/wiki/search.html b/templates/wiki/search.html deleted file mode 100644 index 8a337192..00000000 --- a/templates/wiki/search.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Search{% endblock %} -{% block og_title %}Wiki | Search{% endblock %} -{% block og_description %}Search for pages by content{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <h2 class="uk-title"> - Search - </h2> - - <form uk-grid class="uk-grid-small" action="{{ url_for("wiki.search") }}" method="post"> - <input type="text" class="uk-width-1-1 uk-input location-input" placeholder="Search Query" id="query" name="query" required> - <div class="uk-width-1-4"> - - </div> - <div class="uk-width-1-2"> - <input class="uk-button uk-button-primary uk-width-1-1" type="submit" id="search" value="Search" /> - </div> - - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/search_results.html b/templates/wiki/search_results.html deleted file mode 100644 index 9b9ad946..00000000 --- a/templates/wiki/search_results.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Search Results{% endblock %} -{% block og_title %}Wiki | Search Results{% endblock %} -{% block og_description %}Search results{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - {% if not pages %} - <h2 class="uk-title"> - Search - </h2> - <div class="uk-alert uk-alert-warning uk-text-center"> - <p> - Sorry, no results were found. Please check your query and try again. - </p> - </div> - {% else %} - <h2 class="uk-title"> - Search Results - </h2> - - {% for page in pages %} - <h4> - <a href="{{ url_for("wiki.page", page=page["slug"]) }}">{{ page.title }}</a> - (<span class="fira-code">{{ page.slug }}</span>) - </h4> - - {% for snippet in page["matches"] %} - <div class="quote"> - <i class="uk-icon far fa-ellipsis-h"></i> - <br /> - {{ snippet | safe }} - <br /> - <i class="uk-icon far fa-ellipsis-h"></i> - </div> - {% endfor %} - {% endfor %} - {% endif %} - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/special.html b/templates/wiki/special.html deleted file mode 100644 index 12e9cb18..00000000 --- a/templates/wiki/special.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Special Pages{% endblock %} -{% block og_title %}Wiki | Special Pages{% endblock %} -{% block og_description %}Wiki special pages, non-article informational pages{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <h2 class="uk-title"> - Special Pages - </h2> - - <ul> - <li><a href="{{ url_for("wiki.special.all_pages") }}"> - Special: All Pages - </a></li> - </ul> - </div> -{% endblock %}
\ No newline at end of file diff --git a/templates/wiki/special_all.html b/templates/wiki/special_all.html deleted file mode 100644 index 45a641a6..00000000 --- a/templates/wiki/special_all.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "wiki/base.html" %} -{% block title %}Wiki | Special: All Pages{% endblock %} -{% block og_title %}Wiki | Special: All Pages{% endblock %} -{% block og_description %}A listing for all pages on the wiki{% endblock %} -{% block content %} - <div class="uk-container uk-container-small"> - <h2 class="uk-title"> - Special: All Pages - </h2> - <p class="uk-text-meta"> - A listing for all pages on the wiki - </p> - - {% for letter, pages in letters.items() %} - <h3 class="uk-heading-divider">{{ letter }}</h3> - - <ul> - {% for page in pages %} - <li><a href="{{ url_for("wiki.page", page=page.slug) }}"> - {{ page.title }} (<span class="fira-code">{{ page.slug }}</span>) - </a></li> - {% endfor %} - </ul> - {% endfor %} - </div> -{% endblock %}
\ No newline at end of file |