<commit_before>{% extends '::ojsbase.html.twig' %}
{% block  stylesheets %}
    {{parent()}}
    <link rel="stylesheet" href="{{ asset('/vendor/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.css') }}" />   
{%endblock%}

{% block body -%}
    <div class="large-12 columns">
        <div class="panel">
            <h1>{{ "user.journalrole.send_email"|trans }}</h1>

            <form action="" method="post" role="form">
                <div class="form-group">
                    <label class="control-label" for="">{{ "user.journalrole.mail.template"|trans }}</label>
                    <select name="mail[template]" id="mail_template" class="form-control">
                        <option value="">
                            Seçiniz
                        </option>
                        {% for entity in templates %}
                            <option value="{{ entity.id }}">{{ entity.subject }} [{{ entity.lang }}]</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.to'|trans }}</label>
                    <input class="form-control" type="text" readonly value="{{ user.email }}"/>
                </div>
                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.subject'|trans }}</label>
                    <input class="form-control" type="text" id="mail_subject" name="mail[subject]"/>
                </div>

                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.body'|trans }}</label>
                    <textarea name="mail[body]" class="form-control editor" id="mail_body" cols="30" rows="10"></textarea>
                </div>
                <input type="submit" class="btn btn-primary" value="{{ 'user.journalrole.mail.send'|trans }}"/>
            </form>
        </div>
    </div>

{% endblock %}
{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('/vendor/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min.js') }}"></script>

    <script src="{{ asset('/vendor/twig.js/twig.min.js') }}"></script>
    <script type="text/javascript">
        var user = '{{ user.toJson|raw }}';
        (function($) {
            if (!$.concat) {
                $.extend({
                    concat: function(a, b) {
                        var r = [];
                        for (x in arguments) {
                            r = r.concat(arguments[x]);
                        }
                        return r;
                    }
                });
            };
        })(jQuery);
        function renderMailtemplate(tpl) {
            var tmpl = twig({data: tpl.template});
            console.dir(tmpl.render(tpl));
            $(".wysihtml5-sandbox").contents().find('body').html(tmpl.render(tpl));
            var sbjt = twig({data: tpl.subject});
            $("#mail_subject").val(sbjt.render(tpl));
        }
        $(document).ready(function () {
            {% if selectedTemplate %}
                renderMailtemplate({{selectedTemplate|raw}});
            {%endif%}
            $("textarea.editor").wysihtml5({
                toolbar: {"font-styles": true, "emphasis": true, "lists": false, "html": false, "link": true, "image": false, "color": false, "blockquote": false}
            });
            $(document).on('change', '#mail_template', function () {
                var template = $(this).val();
                $.ajax({
                    url: '/api/mail_template/' + template,
                    method: 'GET',<commit_msg>removed extra code.<commit_after>{% extends '::ojsbase.html.twig' %}
{% block  stylesheets %}
    {{parent()}}
    <link rel="stylesheet" href="{{ asset('/vendor/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.css') }}" />   
{%endblock%}

{% block body -%}
    <div class="large-12 columns">
        <div class="panel">
            <h1>{{ "user.journalrole.send_email"|trans }}</h1>

            <form action="" method="post" role="form">
                <div class="form-group">
                    <label class="control-label" for="">{{ "user.journalrole.mail.template"|trans }}</label>
                    <select name="mail[template]" id="mail_template" class="form-control">
                        <option value="">
                            Seçiniz
                        </option>
                        {% for entity in templates %}
                            <option value="{{ entity.id }}">{{ entity.subject }} [{{ entity.lang }}]</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.to'|trans }}</label>
                    <input class="form-control" type="text" readonly value="{{ user.email }}"/>
                </div>
                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.subject'|trans }}</label>
                    <input class="form-control" type="text" id="mail_subject" name="mail[subject]"/>
                </div>

                <div class="form-group">
                    <label class="control-label" for="">{{ 'user.journalrole.mail.body'|trans }}</label>
                    <textarea name="mail[body]" class="form-control editor" id="mail_body" cols="30" rows="10"></textarea>
                </div>
                <input type="submit" class="btn btn-primary" value="{{ 'user.journalrole.mail.send'|trans }}"/>
            </form>
        </div>
    </div>

{% endblock %}
{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('/vendor/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min.js') }}"></script>

    <script src="{{ asset('/vendor/twig.js/twig.min.js') }}"></script>
    <script type="text/javascript">
        var user = '{{ user.toJson|raw }}';
        function renderMailtemplate(tpl) {
            var tmpl = twig({data: tpl.template});
            console.dir(tmpl.render(tpl));
            $(".wysihtml5-sandbox").contents().find('body').html(tmpl.render(tpl));
            var sbjt = twig({data: tpl.subject});
            $("#mail_subject").val(sbjt.render(tpl));
        }
        $(document).ready(function () {
            {% if selectedTemplate %}
                renderMailtemplate({{selectedTemplate|raw}});
            {%endif%}
            $("textarea.editor").wysihtml5({
                toolbar: {"font-styles": true, "emphasis": true, "lists": false, "html": false, "link": true, "image": false, "color": false, "blockquote": false}
            });
            $(document).on('change', '#mail_template', function () {
                var template = $(this).val();
                $.ajax({
                    url: '/api/mail_template/' + template,
                    method: 'GET',
{'fraction_non_alphanumeric': 0.1819723085617406, 'fraction_numerical': 0.005086182537439954, 'mean_word_length': 1.7717306186374315, 'pattern_counts': {'":': 16, '<': 85, '<?xml version=': 0, '>': 85, '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': '3110771', 'n_tokens_mistral': 2056, 'n_tokens_neox': 1914, 'n_words': 359}