<commit_before>{% extends 'freesources/base.html' %}
{% block head_content %}
    <h1 class="text-center">Freesources Main page</h1>
    <h3 class="text-center">- presented by <a href="https://github.com/Team-Ace">Team ACE</a> at Columbia University</h3>
{% endblock head_content %}

{% block map_content %}
    <div id="map" style="height: 500px"></div>
<script>

    var map = L.map('map').setView([40.807722, -73.964110], 16);

    L.tileLayer('http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.jpg', {
        maxZoom: 18,
        attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
    }).addTo(map);
    

    
    map.on('click', onMapClick);


</script>

    <h2 class="text-center">Events table information list (for debug use only)</h2>
    <table class="table">
        <tr>
        <th>Tag</th>
        <th>Start Time</th>
        <th>Expiration</th>
        <th>Location</th>
        <th>Description</th>
        </tr>
        {% for event in events %}
        <tr>
            <td>{{ event.tag_name }}</td>
            <td>{{ event.start_time}}</td>
            <td>{{ event.expiration}}</td>
            <td>{{ event.location}}</td>
            <td>{{ event.description}}</td>
        <script>
        //    add marker to the map
                var marker = new L.marker(['{{event.latitude}}','{{event.longitude}}']);
                var popup = "<h4 id=\"'{{event.event_id}}'\">Event Details</h4>";
                popup += "<table class=\"table\">";
                popup += "<tr><th>Tag</th><td>";
                popup += '{{event.tag_name}}';
                popup += "</td></tr>";
                popup += "<tr><th>Location</th><td>";
                popup += '{{event.location}}';
                popup += "</td></tr>";
                popup += "<tr><th>Description</th><td>";
                popup += '{{event.description}}';
                popup += "</td></tr>";
                popup += "<tr><th>Type</th><td>";
                popup += '{{event.expire_type}}';
                popup += "</td></tr>";
                popup += "<tr><th>Start Time</th><td>";
                popup += '{{event.start_time}}';
                popup += "</td></tr>";
                popup += "<tr><th>Expiration</th><td>";
                popup += '{{event.expiration}}';
                popup += "</td></tr>";

                if('{{event.feedback_type}}' == 'None'){

                   //        feedback buttons
                    var url = "{% url 'feedback' 'confirm' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-success btn-block" data-toggle="modal" data-target="#submitFeedback">Confirm</button></td><td></td></tr>';

                    url = "{% url 'feedback' 'rej_false' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-danger btn-block" data-toggle="modal" data-target="#submitFeedback">Reject - False Event</button></td>';

                    url = "{% url 'feedback' 'rej_exp' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-warning btn-block" data-toggle="modal" data-target="#submitFeedback">Reject - Expired</button></td></tr>';
                }
                else{
                    popup += "<tr><th><strong>Feedback</strong></th><td><strong>";
                    if('{{event.feedback_type}}' == 'confirm'){
                        popup += "<div style=\"color:green\">Confirm</div>";
                    }
                    else if('{{event.feedback_type}}' == 'rej_false'){
                        popup += "<div style=\"color:red\">Rejection - False Event</div>";
                    }
                    else{
                        popup += "<div style=\"color:#FF5733\">Rejection - Expired</div>";
                    }
                    popup += "</strong></td></tr>"
                }
                popup += "</table>";
                marker.bindPopup(popup);
                map.addLayer(marker);        
        </script>
        {% endfor %}
        <!-- Modal -->
        <div id="submitFeedback" class="modal fade" role="dialog">
          <div class="modal-dialog">

            <!-- Modal content-->
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Confirm Feedback Submission</h4>
              </div>
              <div class="modal-body">
                <p>Are you sure to submit feedback?</p>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-danger" data-dismiss="modal" id="confirmSubmitFeedback">Confirm</button>
              </div>
            </div>

          </div>
        </div>

{% endblock map_content %}<commit_msg>fixing minor problem: change the adding marker iteration from html to js script<commit_after>{% extends 'freesources/base.html' %}
{% block head_content %}
    <h1 class="text-center">Freesources Main page</h1>
    <h3 class="text-center">- presented by <a href="https://github.com/Team-Ace">Team ACE</a> at Columbia University</h3>
{% endblock head_content %}

{% block map_content %}
    <div id="map" style="height: 500px"></div>
<script>

    var map = L.map('map').setView([40.807722, -73.964110], 16);

    L.tileLayer('http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.jpg', {
        maxZoom: 18,
        attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
    }).addTo(map);
    
    {% for event in events %}   
       //    add marker to the map
                var marker = new L.marker(['{{event.latitude}}','{{event.longitude}}']);
                var popup = "<h4 id=\"'{{event.event_id}}'\">Event Details</h4>";
                popup += "<table class=\"table\">";
                popup += "<tr><th>Tag</th><td>";
                popup += '{{event.tag_name}}';
                popup += "</td></tr>";
                popup += "<tr><th>Location</th><td>";
                popup += '{{event.location}}';
                popup += "</td></tr>";
                popup += "<tr><th>Description</th><td>";
                popup += '{{event.description}}';
                popup += "</td></tr>";
                popup += "<tr><th>Type</th><td>";
                popup += '{{event.expire_type}}';
                popup += "</td></tr>";
                popup += "<tr><th>Start Time</th><td>";
                popup += '{{event.start_time}}';
                popup += "</td></tr>";
                popup += "<tr><th>Expiration</th><td>";
                popup += '{{event.expiration}}';
                popup += "</td></tr>";

                if('{{event.feedback_type}}' == 'None'){

                   //        feedback buttons
                    var url = "{% url 'feedback' 'confirm' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-success btn-block" data-toggle="modal" data-target="#submitFeedback">Confirm</button></td><td></td></tr>';

                    url = "{% url 'feedback' 'rej_false' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-danger btn-block" data-toggle="modal" data-target="#submitFeedback">Reject - False Event</button></td>';

                    url = "{% url 'feedback' 'rej_exp' event.event_id %}";
                    popup += '<tr><td>';
                    popup += '<button onclick="feedback(this,\''+ url +'\')" class="btn btn-warning btn-block" data-toggle="modal" data-target="#submitFeedback">Reject - Expired</button></td></tr>';
                }
                else{
                    popup += "<tr><th><strong>Feedback</strong></th><td><strong>";
                    if('{{event.feedback_type}}' == 'confirm'){
                        popup += "<div style=\"color:green\">Confirm</div>";
                    }
                    else if('{{event.feedback_type}}' == 'rej_false'){
                        popup += "<div style=\"color:red\">Rejection - False Event</div>";
                    }
                    else{
                        popup += "<div style=\"color:#FF5733\">Rejection - Expired</div>";
                    }
                    popup += "</strong></td></tr>"
                }
                popup += "</table>";
                marker.bindPopup(popup);
                map.addLayer(marker);        
    {% endfor %}

    map.on('click', onMapClick);


</script>

    <h2 class="text-center">Events table information list (for debug use only)</h2>
    <table class="table">
        <tr>
        <th>Tag</th>
        <th>Start Time</th>
        <th>Expiration</th>
        <th>Location</th>
        <th>Description</th>
        </tr>
        {% for event in events %}
        <tr>
            <td>{{ event.tag_name }}</td>
            <td>{{ event.start_time}}</td>
            <td>{{ event.expiration}}</td>
            <td>{{ event.location}}</td>
            <td>{{ event.description}}</td>
            </tr>
        {% endfor %}
    </table>
    
        <!-- Modal -->
        <div id="submitFeedback" class="modal fade" role="dialog">
          <div class="modal-dialog">

            <!-- Modal content-->
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Confirm Feedback Submission</h4>
              </div>
              <div class="modal-body">
                <p>Are you sure to submit feedback?</p>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-danger" data-dismiss="modal" id="confirmSubmitFeedback">Confirm</button>
              </div>
            </div>

          </div>
        </div>

{% endblock map_content %}
{'fraction_non_alphanumeric': 0.19846905837867748, 'fraction_numerical': 0.007931384303237112, 'mean_word_length': 1.764211062962019, 'pattern_counts': {'":': 0, '<': 293, '<?xml version=': 0, '>': 293, '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': '5207039', 'n_tokens_mistral': 3336, 'n_tokens_neox': 3013, 'n_words': 591}