<commit_before>{% extends "base.html" %}
{% load staticfiles %}

{% block css %}
    {{ block.super }}
    <style>
    .yes {
        color: #4CAF50;
    }
    .no {
        color: #F44336;
    }
    .none {
        color: #888;
    }
    textarea {
        max-width: 600px;
        min-height: 150px;
    }
    .user-list {
        margin-bottom: 1rem;
    }
    </style>
{% endblock %}

{% block js %}
    {{ block.super }}
    <script>
    $(document).ready(function() {
        $("form").submit(function(e) {
            e.preventDefault();
            $("#form button, #form textarea").prop("disabled", true);
            $("#form button").html("<i class='fa fa-cog fa-spin'></i> Processing...");
            $.post("?json", { students: $("#students").val() }, function(data) {
                $.each(data.success, function(k, v) {
                    var item = $("<div class='yes' />");
                    item.text(v);
                    $("#success-list").append(item);
                });
                $.each(data.failure, function(k, v) {
                    var item = $("<div class='no' />");
                    item.text(v);
                    $("#failure-list").append(item);
                });
                $("#form").hide();
                $("#finished-container").show();
            });
        });
    });
    </script>
    {% include "ajax_csrf.html" %}
{% endblock %}

{% block main %}
<h4>Create Student Websites</h4>
<div id="finished-container" {% if not finished %}style="display:none"{% endif %}>
    <p>Finished creating student websites!</p>
    <b>Successes</b>
    <div id="success-list" class="user-list">
        {% if finished %}
            {% for item in success %}
            <div class="yes">{{ item }}</div>
            {% empty %}
            <div class="none">None</div>
            {% endfor %}
        {% endif %}
    </div>
    <b>Failures</b>
    <div id="failure-list" class="user-list">
        {% if finished %}
            {% for item in failure %}
            <div class="no">{{ item }}</div>
            {% empty %}
            <div class="none">None</div>
            {% endfor %}
        {% endif %}
    </div>
    <p>If any student websites could not be created, check to make sure that the username is correct.</p>
    <a href="{% url 'index' %}" class="btn btn-ion"><i class="fa fa-undo"></i> Back</a>
</div>
{% if not finished %}
<form method="POST">
    {% csrf_token %}
    <div class="form-group">
        <label for="students">Student IDs</label>
        <textarea class="form-control" id="students" name="students"></textarea>
        <small class="form-text">Please enter a list of student IDs (ex: 2017ewang) separated by newlines.</small>
    </div>
    <a href="{% url 'index' %}" class="btn btn-ion"><i class="fa fa-undo"></i> Back</a>
    <button class="btn btn-ion"><i class="fa fa-plus"></i> Create Websites</button>
</form>
{% endif %}
{% endblock %}
<commit_msg>fix id<commit_after>{% extends "base.html" %}
{% load staticfiles %}

{% block css %}
    {{ block.super }}
    <style>
    .yes {
        color: #4CAF50;
    }
    .no {
        color: #F44336;
    }
    .none {
        color: #888;
    }
    textarea {
        max-width: 600px;
        min-height: 150px;
    }
    .user-list {
        margin-bottom: 1rem;
    }
    </style>
{% endblock %}

{% block js %}
    {{ block.super }}
    <script>
    $(document).ready(function() {
        $("form").submit(function(e) {
            e.preventDefault();
            $("form button, form textarea").prop("disabled", true);
            $("form button").html("<i class='fa fa-cog fa-spin'></i> Processing...");
            $.post("?json", { students: $("#students").val() }, function(data) {
                $.each(data.success, function(k, v) {
                    var item = $("<div class='yes' />");
                    item.text(v);
                    $("#success-list").append(item);
                });
                $.each(data.failure, function(k, v) {
                    var item = $("<div class='no' />");
                    item.text(v);
                    $("#failure-list").append(item);
                });
                $("form").hide();
                $("#finished-container").show();
            });
        });
    });
    </script>
    {% include "ajax_csrf.html" %}
{% endblock %}

{% block main %}
<h4>Create Student Websites</h4>
<div id="finished-container" {% if not finished %}style="display:none"{% endif %}>
    <p>Finished creating student websites!</p>
    <b>Successes</b>
    <div id="success-list" class="user-list">
        {% if finished %}
            {% for item in success %}
            <div class="yes">{{ item }}</div>
            {% empty %}
            <div class="none">None</div>
            {% endfor %}
        {% endif %}
    </div>
    <b>Failures</b>
    <div id="failure-list" class="user-list">
        {% if finished %}
            {% for item in failure %}
            <div class="no">{{ item }}</div>
            {% empty %}
            <div class="none">None</div>
            {% endfor %}
        {% endif %}
    </div>
    <p>If any student websites could not be created, check to make sure that the username is correct.</p>
    <a href="{% url 'index' %}" class="btn btn-ion"><i class="fa fa-undo"></i> Back</a>
</div>
{% if not finished %}
<form method="POST">
    {% csrf_token %}
    <div class="form-group">
        <label for="students">Student IDs</label>
        <textarea class="form-control" id="students" name="students"></textarea>
        <small class="form-text">Please enter a list of student IDs (ex: 2017ewang) separated by newlines.</small>
    </div>
    <a href="{% url 'index' %}" class="btn btn-ion"><i class="fa fa-undo"></i> Back</a>
    <button class="btn btn-ion"><i class="fa fa-plus"></i> Create Websites</button>
</form>
{% endif %}
{% endblock %}

{'fraction_non_alphanumeric': 0.19813084112149532, 'fraction_numerical': 0.008156329651656755, 'mean_word_length': 1.8995073891625616, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2753188', 'n_tokens_mistral': 1946, 'n_tokens_neox': 1784, 'n_words': 411}