<commit_before>{% extends 'layout.twig' %}

{% import 'Macro/form.twig' as form %}

{% block body %}

<div class="ui fluid container">
    <div id="map"></div>
    <br>
    <div class="ui container">
        <a href="{{ path_for('add_point') }}" class="menu-button1 ui circular teal right floated button"><i class="plus icon"></i>Add a location</a>
        {% if points is not empty %}
            <a href="{{ path_for('add_event') }}" class="menu-button2 ui circular yellow right floated button"><i class="star icon"></i>Create an event</a>
        {% endif %}
    </div>

    <div class="ui modal" id="comments-modal">
        <i class="close icon"></i>
        <div class="header" id="modalTitle"></div>
        <div class="content">
            <div id="commentsArea"></div>
            <div class="ui divider"></div>
            <h5>Your comment : </h5>
            <form action="{{ path_for('add_comment') }}" method="POST" class="ui form error">
                <div class="two fields">
                    {{ form.group('author', null, 'author', 'Author') }}
                    {{ form.group('comment', null, 'comment', 'Comment') }}
                </div>
                {{ form.group('location', null, 'location', null, null, 'hidden') }}

                {{ csrf() }}
                <div class='pull-right fields'>
                    <button type="submit" class="ui circular teal labeled icon button"><i class="checkmark icon"></i> Add</button>
                    <div id="eventLocation"></div>
                </div>
            </form>

        </div>
    </div>
</div>

<script>
    function loadComments(comment_id) {
        $.getJSON('./api/comments/' + comment_id).done(function (data) {
            if (!$.trim(data)){
                $('#commentsArea').append($('<h4>').text('It is empty, be the first person to comment!'));
            }else{
                $.each(data, function (index, datum) {
                    var author = $('<div>').addClass('comment-author').text(datum.author + ' said : ');
                    var text = $('<div>').addClass('comment-text').text(datum.comment);
                    var box = $('<div>').addClass('comment-box').append(author).append(text);
                    var container = $('<div>').append(box);
                    $('#commentsArea').append(container);
                });
            }
        }).fail(function () {
            console.log('AJAX Error ! Cannot reach the server ');
        });
    }

    var map;
    var color = "fec52e";

    function initialize() {
        map = new google.maps.Map(document.getElementById('map'), {
            center: {lat: 47.08, lng: 2.4},
            zoom: 3
        });

        var markerEvent = new google.maps.MarkerImage (
            "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + color,
            new google.maps.Size(25, 35),
            new google.maps.Point(0, 0),
            new google.maps.Point(10, 35)
        );

        {% for point in points %}
            new google.maps.Marker({
                title: '{{ point.name }}',
                position: {lat: {{ point.latitude }}, lng: {{ point.longitude }} },
                map: map,
                {{ ( point.numberEvent > 0 ? 'icon : markerEvent,' ) }}
            }).addListener('click', function() {
                $('#modalTitle').text('Comments about {{ point.name }}');
                $('#comments-modal').modal('show');
                $('#location').val('{{ point._id }}');
                $('#commentsArea').empty();
                loadComments('{{ point._id }}');
                $('#eventLocation').empty();
                {% if (point.numberEvent > 0) %}
                     var button = "<a href='{{ path_for('get_point_events' , {'id': point._id})  }}'<button class='ui circular yellow labeled icon button'><i class='icon star'></i> {{ (point.numberEvent == 1  ? 'One event there' : point.numberEvent ~ ' events there' ) }} </button></a>";
                    $('#eventLocation').append(button);
                {% endif %}
            });
        {% endfor %}
    }
</script>

<script async defer
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAkIJ7rDp2F0J39TH8DRIvqtYHrJx-Zsi8&callback=initialize">
</script>

{% endblock %}<commit_msg>Added copyright and executed time of the query<commit_after>{% extends 'layout.twig' %}

{% import 'Macro/form.twig' as form %}

{% block body %}

<div class="ui fluid container">
    <div id="map"></div>
    <br>
    <div class="ui container">
        <a href="{{ path_for('add_point') }}" class="menu-button1 ui circular teal right floated button"><i class="plus icon"></i>Add a location</a>
        {% if points is not empty %}
            <a href="{{ path_for('add_event') }}" class="menu-button2 ui circular yellow right floated button"><i class="star icon"></i>Create an event</a>
        {% endif %}
    </div>

    <div class="ui modal" id="comments-modal">
        <i class="close icon"></i>
        <div class="header" id="modalTitle"></div>
        <div class="content">
            <div id="commentsArea"></div>
            <div class="ui divider"></div>
            <h5>Your comment : </h5>
            <form action="{{ path_for('add_comment') }}" method="POST" class="ui form error">
                <div class="two fields">
                    {{ form.group('author', null, 'author', 'Author') }}
                    {{ form.group('comment', null, 'comment', 'Comment') }}
                </div>
                {{ form.group('location', null, 'location', null, null, 'hidden') }}

                {{ csrf() }}
                <div class='pull-right fields'>
                    <button type="submit" class="ui circular teal labeled icon button"><i class="checkmark icon"></i> Add</button>
                    <div id="eventLocation"></div>
                </div>
            </form>

        </div>
    </div>
</div>
<footer>
    <div class="ui inverted vertical footer segment">
        <div class="ui container">
            <div class="ui stackable inverted divided equal height stackable grid">
                <div class=" wide column">
                    <p class="ui inverted"> <br>
                        Copyright 2017 -
                        Made with <small><i class='heart icon'></i></small>by <NAME> & <NAME>
                        - <i>Executed in {{ time }} milliseconds with the powerful MongoDB Engine</i>
                    </p>
                </div>
            </div>
        </div>
    </div>

</footer>


<script>
    function loadComments(comment_id) {
        $.getJSON('./api/comments/' + comment_id).done(function (data) {
            if (!$.trim(data)){
                $('#commentsArea').append($('<h4>').text('It is empty, be the first person to comment!'));
            }else{
                $.each(data, function (index, datum) {
                    var author = $('<div>').addClass('comment-author').text(datum.author + ' said : ');
                    var text = $('<div>').addClass('comment-text').text(datum.comment);
                    var box = $('<div>').addClass('comment-box').append(author).append(text);
                    var container = $('<div>').append(box);
                    $('#commentsArea').append(container);
                });
            }
        }).fail(function () {
            console.log('AJAX Error ! Cannot reach the server ');
        });
    }

    var map;
    var color = "fec52e";

    function initialize() {
        map = new google.maps.Map(document.getElementById('map'), {
            center: {lat: 47.08, lng: 2.4},
            zoom: 3
        });

        var markerEvent = new google.maps.MarkerImage (
            "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + color,
            new google.maps.Size(25, 35),
            new google.maps.Point(0, 0),
            new google.maps.Point(10, 35)
        );

        {% for point in points %}
            new google.maps.Marker({
                title: '{{ point.name }}',
                position: {lat: {{ point.latitude }}, lng: {{ point.longitude }} },
                map: map,
                {{ ( point.numberEvent > 0 ? 'icon : markerEvent,' ) }}
            }).addListener('click', function() {
                $('#modalTitle').text('Comments about {{ point.name }}');
                $('#comments-modal').modal('show');
                $('#location').val('{{ point._id }}');
                $('#commentsArea').empty();
                loadComments('{{ point._id }}');
                $('#eventLocation').empty();
                {% if (point.numberEvent > 0) %}
                     var button = "<a href='{{ path_for('get_point_events' , {'id': point._id})  }}'<button class='ui circular yellow labeled icon button'><i class='icon star'></i> {{ (point.numberEvent == 1  ? 'One event there' : point.numberEvent ~ ' events there' ) }} </button></a>";
                    $('#eventLocation').append(button);
                {% endif %}
            });
        {% endfor %}
    }
</script>

<script async defer
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAkIJ7rDp2F0J39TH8DRIvqtYHrJx-Zsi8&callback=initialize">
</script>



{% endblock %}
{'fraction_non_alphanumeric': 0.17967312479705597, 'fraction_numerical': 0.008658945773352094, 'mean_word_length': 1.915746292205743, 'pattern_counts': {'":': 0, '<': 136, '<?xml version=': 0, '>': 138, 'https://': 2, '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': '394799', 'n_tokens_mistral': 2734, 'n_tokens_neox': 2549, 'n_words': 590}