TabbycatDebate/tabbycat

View on GitHub
tabbycat/tournaments/templates/create_tournament.html

Summary

Maintainability
Test Coverage
{% extends "base.html" %}
{% load add_field_css i18n %}

{% block head-title %}<span class="emoji">🏆</span>{% trans "Create New Tournament"%}{% endblock %}
{% block page-title %}{% trans "Tabbycat" %}{% endblock %}
{% block sidebar %}{% endblock %} {# Need to override sidebar manually it will crash when no tournaments are present. Ideally this would be handled with the Mixins but this is a relatively unique view as it is part of Tournaments but is admin-only and thus shown with the sidebar #}

{% block page-alerts %}
  {% include 'errors/database_limit_warning.html' %}
{% endblock %}

{% block content %}

  {% blocktrans trimmed asvar donation %}
    Tabbycat is free to use, although <a href="https://opencollective.com/tabbycat">donations</a> are encouraged.
  {% endblocktrans %}
  {% include "components/explainer-card.html" with type="primary" p1=donation %}

  <div class="card border-info text-info mt-3">
    <div class="card-body">

      <strong>{% trans "Just trying out Tabbycat?" %}</strong>
      {% blocktrans trimmed %}
        If you're learning or playing around with Tabbycat, it's easiest to
        create a demo tournament that is prepopulated with a fake (but typical)
        set of teams, adjudicators, rooms, and the like. You can then delete
        this demo tournament later on, or deploy a new instance for your real
        tournament.
      {% endblocktrans %}

      <div class="row mt-3">
        {% for slug, demo in demo_datasets %}
          <div class="col col-md-4">
            <form action="{% url 'load-demo' %}" method="POST">
              <input type="hidden" name="source" value="{{ slug }}">
              <button type="submit" class="btn btn-info btn-block">
                {% blocktrans trimmed %}
                  Load {{ demo }}
                {% endblocktrans %}
              </button>
            </form>
            {% if slug in preexisting %}
              <div class="alert alert-warning mt-3 mb-0 small">
                {% blocktrans trimmed %}
                  You already have a tournament set up using this data set. Reloading
                  the data will delete <strong>all data</strong> from that tournament.
                {% endblocktrans %}
              </div>
            {% endif %}
          </div>
        {% endfor %}
      </div>

    </div>
  </div>

  <div class="card mt-3">
    <div class="list-group list-group-flush">
    <form action="." method="POST">
      {% csrf_token %}

      {% include "components/form-main.html" %}

      {% trans "Create Tournament" as title %}
      {% trans "Cancel and go back to the site home page" as subtitle %}
      {% url 'tabbycat-index' as suburl %}
      {% include "components/form-submit.html" %}

    </form>
    </div>
  </div>

{% endblock %}