<commit_before>{% extends "core/base.html" %}
{% load i18n leaflet_tags %}

{% block extrahead %}
    {{ block.super }}
    {% leaflet_css %}
    {% leaflet_js %}
{% endblock extrahead %}


{% block mainmap %}
    {% leaflet_map "mainmap" %}
{% endblock mainmap %}


{% block mainactions %}
    {% if user.profile.is_path_manager %}
    <a class="btn" href="{{ path.get_add_url }}"><i class="icon-plus"></i> {% trans "Add a path" %}</a>
    {% else %}
    <a class="btn disabled" href="#"><i class="icon-plus"></i> {% trans "Add a path" %}</a>
    {% endif %}
{% endblock mainactions %}


{% block mainlist %}
    <!-- Liste des résultats -->
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th>{% trans "Modified" %}</th>
                <th>{% trans "Length" %}</th>
                <th>{% trans "Management" %}</th>
            </tr>
        </thead>
        <tbody>
            {% for path in path_list %}
            <tr>
                <td><a href="{{ path.get_detail_url }}">{{ path }}</a></td>
                <td>{{ path.date_update }}</td>
                <td>{{ path.length }}</td>
                <td>{{ path.path_management }}</td>
            </tr>
            {% empty %}
                <tr>
                    <td colspan="4">{% trans "Empty" %}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock mainlist %}


{% block extrabody %}
    {{ block.super }}
    
    <h1>Listes temporaires (recette stories #10, 15, #31)</h1>

    <h2>{% trans "Usages" %}</h2>
    {% for usage in all_usages %}
        <li>{{ usage }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}

    <h2>{% trans "Contractors" %}</h2>
    {% for contractor in all_contractors %}
        <li>{{ contractor }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}

    <h2>{% trans "Structure related" %}</h2>
    {% for contractor in contractors %}
        <li>{{ contractor }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}
    
    <script type="text/javascript">
        function mainmapInit(mainmap) {
            var spinner = new Spinner().spin(document.getElementById('mainmap'));
            
            var geojsonLayer = new L.GeoJSON(null, {
                onEachFeature: function (feature, layer) {
                    if (feature.properties && feature.properties.name) {
                        layer.bindPopup(feature.properties.name);
                    }
                }
            });
            
            $.getJSON("{% url core:layer_path %}", function (data) {           
                geojsonLayer.addData(data);
                spinner.stop();
            });
            
            mainmap.addLayer(geojsonLayer);
        }
    </script>
{% endblock extrabody %}<commit_msg>Clic on map redirects to path detail<commit_after>{% extends "core/base.html" %}
{% load i18n leaflet_tags %}

{% block extrahead %}
    {{ block.super }}
    {% leaflet_css %}
    {% leaflet_js %}
{% endblock extrahead %}


{% block mainmap %}
    {% leaflet_map "mainmap" %}
{% endblock mainmap %}


{% block mainactions %}
    {% if user.profile.is_path_manager %}
    <a class="btn" href="{{ path.get_add_url }}"><i class="icon-plus"></i> {% trans "Add a path" %}</a>
    {% else %}
    <a class="btn disabled" href="#"><i class="icon-plus"></i> {% trans "Add a path" %}</a>
    {% endif %}
{% endblock mainactions %}


{% block mainlist %}
    <!-- Liste des résultats -->
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th>{% trans "Modified" %}</th>
                <th>{% trans "Length" %}</th>
                <th>{% trans "Management" %}</th>
            </tr>
        </thead>
        <tbody>
            {% for path in path_list %}
            <tr>
                <td><a href="{{ path.get_detail_url }}">{{ path }}</a></td>
                <td>{{ path.date_update }}</td>
                <td>{{ path.length }}</td>
                <td>{{ path.path_management }}</td>
            </tr>
            {% empty %}
                <tr>
                    <td colspan="4">{% trans "Empty" %}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock mainlist %}


{% block extrabody %}
    {{ block.super }}
    
    <h1>Listes temporaires (recette stories #10, 15, #31)</h1>

    <h2>{% trans "Usages" %}</h2>
    {% for usage in all_usages %}
        <li>{{ usage }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}

    <h2>{% trans "Contractors" %}</h2>
    {% for contractor in all_contractors %}
        <li>{{ contractor }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}

    <h2>{% trans "Structure related" %}</h2>
    {% for contractor in contractors %}
        <li>{{ contractor }}</li>
    {% empty %}
        {% trans "Empty" %}
    {% endfor %}
    
    <script type="text/javascript">
        function mainmapInit(mainmap) {
            var spinner = new Spinner().spin(document.getElementById('mainmap'));
            
            var geojsonLayer = new L.GeoJSON(null, {
                onEachFeature: function (feature, layer) {
                    layer.on('click', function (e) {
                        //TODO use nice JS url rewriting
                        window.location = "{% url core:path_detail 0 %}".replace('0', feature.properties.pk);
                    });
                    if (feature.properties && feature.properties.name) {
                        layer.bindPopup(feature.properties.name);
                    }
                }
            });
            
            $.getJSON("{% url core:layer_path %}", function (data) {           
                geojsonLayer.addData(data);
                spinner.stop();
            });
            
            mainmap.addLayer(geojsonLayer);
        }
    </script>
{% endblock extrabody %}
{'fraction_non_alphanumeric': 0.1781637717121588, 'fraction_numerical': 0.005955334987593052, 'mean_word_length': 1.6275532377227293, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 117, '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': '5989552', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1764, 'n_words': 417}