<commit_before>{% extends 'main/base.html' %}
{% load i18n %}
{% load extras %}

{% block title %}{% trans 'New thread' %}{% endblock %}
{% block current %}new{% endblock %}

{% block head %}
    <script type="text/javascript" src="{% setting 'STATIC_URL' %}js/django-dynamic-formset/src/jquery.formset.js"></script>
    <script type="text/javascript">
        $(function() {
                $('#thread_form div#tweet_formsets p').formset({
                    addCssClass: 'formset-add-button',
                    deleteCssClass: 'formset-delete-button',
                    addText: 'Add',
                    deleteText: 'Delete'
                });
                $('.formset-add-button').addClass('button positive');
                $('.formset-delete-button').addClass('button negative');
                $('.formset-add-button').after('<a href="#" class="button" id="lookup-tweet">Lookup thread</a>');
                $('#lookup-tweet').click(function () {
                    //$('.formset-add-button').click();
                    var val = $('div#tweet_formsets p input').first().val();
                    if (val) {
                        $.getJSON(
                            "{% url ajax-lookup-thread %}",
                            {'tweet_id': val},
                            function (data) {
                                alert(data);
                            }
                        );
                    }
                });
        })
</script>
{% endblock %}

{% block content %}
    <form method="post" id="thread_form">
        {{ formset.management_form }}
        <fieldset>
            <div id="tweet_formsets">
            {% for form in formset.forms %}
                {{ form.as_p }}
                {% endfor %}
            </div>
            <div><button type="submit" id="thread-submit-button" class="button">Thread it!</button></div>
        </fieldset>
    </form>
{% endblock %}<commit_msg>Added footnote about lookups only being in reverse<commit_after>{% extends 'main/base.html' %}
{% load i18n %}
{% load extras %}

{% block title %}{% trans 'New thread' %}{% endblock %}
{% block current %}new{% endblock %}

{% block head %}
    <script type="text/javascript" src="{% setting 'STATIC_URL' %}js/django-dynamic-formset/src/jquery.formset.js"></script>
    <script type="text/javascript">
        $(function() {
                $('#thread_form div#tweet_formsets p').formset({
                    addCssClass: 'formset-add-button',
                    deleteCssClass: 'formset-delete-button',
                    addText: 'Add',
                    deleteText: 'Delete'
                });
                $('.formset-add-button').addClass('button positive');
                $('.formset-delete-button').addClass('button negative');
                $('.formset-add-button').after('<a href="#" class="button" id="lookup-tweet">Lookup thread*</a>');
                $('#lookup-footnote').show();
                $('#lookup-tweet').click(function () {
                    //$('.formset-add-button').click();
                    var val = $('div#tweet_formsets p input').first().val();
                    if (val) {
                        $.getJSON(
                            "{% url ajax-lookup-thread %}",
                            {'tweet_id': val},
                            function (data) {
                                alert(data);
                            }
                        );
                    }
                });
        })
</script>
{% endblock %}

{% block content %}
    <form method="post" id="thread_form">
        {{ formset.management_form }}
        <fieldset>
            <div id="tweet_formsets">
            {% for form in formset.forms %}
                {{ form.as_p }}
                {% endfor %}
            </div>
            <p id="lookup-footnote" class="alt hide">* Only works in reverse, e.g. enter the last tweet in the thread to look up other tweets.</p>
            <div><button type="submit" id="thread-submit-button" class="button">Thread it!</button></div>
        </fieldset>
    </form>
{% endblock %}
{'fraction_non_alphanumeric': 0.1658169458606458, 'fraction_numerical': 0.0009711094925952901, 'mean_word_length': 1.5076080340839928, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2991576', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1071, 'n_words': 211}