<commit_before>{% extends 'base.html.twig' %}

{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('css/nouislider.css') }}" rel="stylesheet" />
    <link href="{{ asset('css/nouislider.pips.css') }}" rel="stylesheet" />
    <link href="{{ asset('css/select2.min.css') }}" rel="stylesheet" />
    <style type="text/css">
        /* Prevent zoom on input in mobile Safari */
        input[type='text'],
        input[type='number'],
        input[type='search'],
        input[type='date'],
        select.form-control,
        textarea,
        textarea.form-control {
            font-size: 16px;
        }

        /* Slider */
        #slider { margin-bottom: 40px; }
        #slider .noUi-marker-horizontal.noUi-marker-large {
            height: 10px;
        }
        #slider .noUi-marker-horizontal.noUi-marker-sub {
            height: 5px;
            width: 1px;
        }
        #slider .noUi-value-horizontal {
            padding-top: 10px;
        }
        #slider.noUi-connect { background: #EB9D9E; }

        #form-group-factors .select2-container .select2-search--inline .select2-search__field {
            font-size: 16px;
        }

        .compact-time .form-inline .form-control {
            display: inline-block;
            width: auto;
            vertical-align: middle;
        }
        .compact-time input[type=date] {
            margin-right: 2px;
        }

    </style>
{% endblock %}

{% block javascripts %}
    {{ parent() }}

    <script src="{{ asset('js/nouislider.js') }}"></script>
    <script src="{{ asset('js/select2.full.min.js') }}"></script>
    <script type="text/javascript">
        $(function() {
            // Slider
            var slider = document.getElementById('slider');
            noUiSlider.create(slider, {
                start: {{ form.vars.value.level }},
                step: 1,
                connect: 'lower',
                range: {
                    min: 0,
                    max: 10
                },
                pips: { // Show a scale with the slider
                    mode: 'steps',
                    density: 10
                }
            });
            slider.noUiSlider.on('set', function() {
                document.getElementById('stress_log_form_level').value = parseInt(slider.noUiSlider.get());
            });

            // Factor tags
            $('.tag-selector').select2({
                tags: true
                , closeOnSelect: false
                , tokenSeparators: [',']
                /*
                ,
                data: [
                    // { id: "optgroup1", text: "Suggestions", children: [
                        { id: "kids", text: "kids" },
                        { id: "tension: neck and shoulders", text: "tension: neck and shoulders" },
                        { id: "multitasking", text: "multitasking" },
                    // ]},
                    // { id: "optgroup2", text: "All", children: [
                        { id: "butterflies", text: "butterflies"},
                        { id: "cannabis", text: "cannabis"},
                        { id: "family", text: "family"},
                        { id: "job", text: "job"},
                        // { id: "kids", text: "kids" },
                        // { id: "multitasking", text: "multitasking" },
                        { id: "sick", text: "sick" },
                        // { id: "tension: neck and shoulders", text: "tension: neck and shoulders" },
                        { id: "tension: stomach", text: "tension: stomach" }
                    // ]}
                ],
                multiple: true,
                */
            });

        });
    </script>
{% endblock %}

{% block body %}
    <div class="page-header">
        <h1>
            {% block title %}Edit log entry{% endblock %}
        </h1>
    </div>

    {{ form_start(form) }}

        {{ form_errors(form) }}

        <div class="form-group">
            {{ form_label(form.level) }}
            {{ form_errors(form.level) }}
            {{ form_widget(form.level) }}
            <div id="slider"></div>
        </div>

        <div class="form-group" id="form-group-factors">
            {{ form_label(form.manifestationTexts) }}
            {{ form_errors(form.manifestationTexts) }}
            {{ form_widget(form.manifestationTexts, {'attr': {'class': 'tag-selector'}}) }}
        </div>

        <div class="form-group">
            {{ form_label(form.notes) }}
            {{ form_errors(form.notes) }}
            {{ form_widget(form.notes) }}
        </div>


        <div class="form-group compact-time">
            {{ form_errors(form.notes) }}
            <label class="control-label" for="stress_log_form_time_date">
                Time:
                <a role="button" data-toggle="collapse" href="#collapseTime" aria-expanded="false" aria-controls="collapseTime">
                    {{ form.vars.value.time|date }}
                </a>
                <div class="collapse" id="collapseTime">
                    <div class="well">
                        {{ form_widget(form.time) }}
                    </div>
                </div>
            </label>
        </div>

        <div>
            {% if log is defined %}
                <button type="submit" class="btn btn-default">Save entry</button>
                <a style="margin-left: 10px;" href="{{ path('showLog', {'id': log.id}) }}">Cancel</a>
            {% else %}
                <button type="submit" class="btn btn-default">Add entry</button>
            {% endif %}
        </div>

    {{ form_end(form) }}
{% endblock %}

<commit_msg>Tweak log entry form.<commit_after>{% extends 'base.html.twig' %}

{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('css/nouislider.css') }}" rel="stylesheet" />
    <link href="{{ asset('css/nouislider.pips.css') }}" rel="stylesheet" />
    <link href="{{ asset('css/select2.min.css') }}" rel="stylesheet" />
    <style type="text/css">
        /* Prevent zoom on input in mobile Safari */
        input[type='text'],
        input[type='number'],
        input[type='search'],
        input[type='date'],
        select.form-control,
        textarea,
        textarea.form-control {
            font-size: 16px;
        }

        /* Slider */
        #slider { margin-bottom: 40px; }
        #slider .noUi-marker-horizontal.noUi-marker-large {
            height: 10px;
        }
        #slider .noUi-marker-horizontal.noUi-marker-sub {
            height: 5px;
            width: 1px;
        }
        #slider .noUi-value-horizontal {
            padding-top: 10px;
        }
        #slider.noUi-connect { background: #EB9D9E; }

        #form-group-factors .select2-container .select2-search--inline .select2-search__field {
            font-size: 16px;
        }

        .compact-time .form-inline .form-control {
            display: inline-block;
            width: auto;
            vertical-align: middle;
        }
        .compact-time input[type=date] {
            margin-right: 2px;
        }

    </style>
{% endblock %}

{% block javascripts %}
    {{ parent() }}

    <script src="{{ asset('js/nouislider.js') }}"></script>
    <script src="{{ asset('js/select2.full.min.js') }}"></script>
    <script type="text/javascript">
        $(function() {
            // Slider
            var slider = document.getElementById('slider');
            noUiSlider.create(slider, {
                start: {{ form.vars.value.level }},
                step: 1,
                connect: 'lower',
                range: {
                    min: 0,
                    max: 10
                },
                pips: { // Show a scale with the slider
                    mode: 'steps',
                    density: 10
                }
            });
            slider.noUiSlider.on('set', function() {
                document.getElementById('stress_log_form_level').value = parseInt(slider.noUiSlider.get());
            });

            // Factor tags
            $('.tag-selector').select2({
                tags: true
                , closeOnSelect: false
                , tokenSeparators: [',']
                /*
                ,
                data: [
                    // { id: "optgroup1", text: "Suggestions", children: [
                        { id: "kids", text: "kids" },
                        { id: "tension: neck and shoulders", text: "tension: neck and shoulders" },
                        { id: "multitasking", text: "multitasking" },
                    // ]},
                    // { id: "optgroup2", text: "All", children: [
                        { id: "butterflies", text: "butterflies"},
                        { id: "cannabis", text: "cannabis"},
                        { id: "family", text: "family"},
                        { id: "job", text: "job"},
                        // { id: "kids", text: "kids" },
                        // { id: "multitasking", text: "multitasking" },
                        { id: "sick", text: "sick" },
                        // { id: "tension: neck and shoulders", text: "tension: neck and shoulders" },
                        { id: "tension: stomach", text: "tension: stomach" }
                    // ]}
                ],
                multiple: true,
                */
            });

        });
    </script>
{% endblock %}

{% block body %}
    <div class="page-header">
        <h1>
            {% block title %}Edit log entry{% endblock %}
        </h1>
    </div>

    {{ form_start(form) }}

        {{ form_errors(form) }}

        <div class="form-group compact-time">
            {{ form_errors(form.notes) }}
            <!--label class="control-label" for="stress_log_form_time_date">
                Time:-->
                    <span style="font-weight: normal;">
                        {{ form.vars.value.time|date }}
                        UTC
                        <a title="Change time" class="small" style="margin-left: 5px;" role="button" data-toggle="collapse" href="#collapseTime" aria-expanded="false" aria-controls="collapseTime">
                            <span class="glyphicon glyphicon-pencil"></span>
                        </a>
                    </span>
                <div class="collapse" id="collapseTime">
                    <div class="well">
                        {{ form_widget(form.time) }}
                    </div>
                </div>
            <!--/label-->
        </div>

        <div class="form-group">
            {{ form_label(form.level) }}
            {{ form_errors(form.level) }}
            {{ form_widget(form.level) }}
            <div id="slider"></div>
        </div>

        <div class="form-group" id="form-group-factors">
            {{ form_label(form.manifestationTexts) }}
            {{ form_errors(form.manifestationTexts) }}
            {{ form_widget(form.manifestationTexts, {'attr': {'class': 'tag-selector'}}) }}
        </div>

        <div class="form-group">
            {{ form_label(form.notes) }}
            {{ form_errors(form.notes) }}
            {{ form_widget(form.notes) }}
        </div>


        <div>
            {% if log is defined %}
                <button type="submit" class="btn btn-default">Save entry</button>
                <a class="btn btn-link" href="{{ path('showLog', {'id': log.id}) }}">Cancel</a>
            {% else %}
                <button type="submit" class="btn btn-default">Add entry</button>
            {% endif %}
        </div>

    {{ form_end(form) }}
{% endblock %}


{'fraction_non_alphanumeric': 0.15810413423283168, 'fraction_numerical': 0.005621864729285591, 'mean_word_length': 1.3816683831101957, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 90, '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': '123351', 'n_tokens_mistral': 3403, 'n_tokens_neox': 3124, 'n_words': 618}