<commit_before>{% extends "admin/change_form.html" %}
{% load flatblockspreview_tags static %}

{% block bodyclass %}{{ block.super }}
    {{ original.mailing_set.all }}
{% endblock %}

{% block extrastyle %}
    <style>
        [name=content] {
            width: 40%;
        }

        .content-preview {
            display: inline-block;
            margin-left: 2%;
            width: 40%;
        }
    </style>
{% endblock %}

{% block extrahead %}{{ block.super }}
    {% preview_url original as flatblock_preview_url %}
    <script src="{% static "bower_components/underscore/underscore-min.js" %}"></script>
    <script>
        (function ($) {
            $(document).ready(function() {
                var $content = $(':input[name=content]'),
                    $preview = $('<div></div>').addClass('content-preview'),
                    url = '{{ flatblock_preview_url }}';
                $content.after($preview);

                // If there is no preview url, jump out here
                if (url === '') {
                    $preview.text('Sorry, no preview is available.');
                    return;
                }

                function updatePreview() {
                    $.ajax(url, {
                        data: {
                            content: $content.val()
                        },
                        type: 'POST'
                    })
                        .done(function (data) {
                            $preview.html(data);
                        });
                }
                updatePreview();

                var debouncedUpdatePreview = _.debounce(updatePreview, 350);
                $content.keyup(debouncedUpdatePreview);
            });
        })(django.jQuery);
    </script>
{% endblock %}<commit_msg>Add header to make it more clear that this is a preview<commit_after>{% extends "admin/change_form.html" %}
{% load flatblockspreview_tags static %}

{% block bodyclass %}{{ block.super }}
    {{ original.mailing_set.all }}
{% endblock %}

{% block extrastyle %}
    <style>
        [name=content] {
            width: 40%;
        }

        .content-preview-wrapper {
            display: inline-block;
            margin-left: 2%;
            width: 40%;
        }
    </style>
{% endblock %}

{% block extrahead %}{{ block.super }}
    {% preview_url original as flatblock_preview_url %}
    <script src="{% static "bower_components/underscore/underscore-min.js" %}"></script>
    <script>
        (function ($) {
            $(document).ready(function() {
                var $content = $(':input[name=content]'),
                    $previewWrapper = $('<div></div>').addClass('content-preview-wrapper'),
                    $preview = $('<div></div>').addClass('content-preview'),
                    url = '{{ flatblock_preview_url }}';
                $previewWrapper
                    .append($('<h2></h2>').text('Email preview:'))
                    .append($preview);
                $content.after($previewWrapper);

                // If there is no preview url, jump out here
                if (url === '') {
                    $preview.text('Sorry, no preview is available.');
                    return;
                }

                function updatePreview() {
                    $.ajax(url, {
                        data: {
                            content: $content.val()
                        },
                        type: 'POST'
                    })
                        .done(function (data) {
                            $preview.html(data);
                        });
                }
                updatePreview();

                var debouncedUpdatePreview = _.debounce(updatePreview, 350);
                $content.keyup(debouncedUpdatePreview);
            });
        })(django.jQuery);
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.14037814037814036, 'fraction_numerical': 0.004662004662004662, 'mean_word_length': 1.3293124246079615, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3526836', 'n_tokens_mistral': 1049, 'n_tokens_neox': 932, 'n_words': 189}