{% macro paginated(entities, title, column) %} {{ knp_pagination_sortable(entities, title, column) }} {% if entities.isSorted(column) %} <span class="badge text-bg-secondary"> {% if entities.params.direction == 'asc' %} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-sort-alpha-down" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.419-1.371zm1.57-.785L11 2.687h-.047l-.652 2.157z"/> <path d="M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645zM4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293z"/> </svg> {% endif %} {% if entities.params.direction == 'desc' %} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-sort-alpha-down-alt" viewBox="0 0 16 16"> <path d="M12.96 7H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645z"/> <path fill-rule="evenodd" d="M10.082 12.629 9.664 14H8.598l1.789-5.332h1.234L13.402 14h-1.12l-.419-1.371zm1.57-.785L11 9.688h-.047l-.652 2.156z"/> <path d="M4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293z"/> </svg> {% endif %} </span> {% endif %} {% endmacro %} {# Produit le HTML géré par le contrôleur Stimulus `map` et permet d’afficher une carte interactive Où : * `entity` peut être une instance de `Project` ou de `Task` pour représenter ce qu’il faut mapper * `overpassResult` est optionnel pour représenter ce qui est actuellement mappé #} {% macro map(entity, overpassResult='') %} <div data-controller="map" data-map-geojson-value="{{ geoJsonManager.generateGeoJson(entity)|json_encode }}" {% if overpassResult is not empty %} data-map-overpass-result-value="{{ overpassResult }}" data-map-popup-url-value={{ url('app_map_popup') }} {% endif %} data-map-icon-value="{{ asset('images/marker.svg') }}" > <div id="map" class="img-fluid img-thumbnail min-vh-50" ></div> <details> <summary>Légende</summary> <span class="badge bg-info">Overpass</span> {% set stats = taskLifecycleManager.getProjectStats(entity) %} {% for place, data in stats %} <span class="badge {{ 'bg-' ~ data.color }}">{{ data.title }}</span> {% endfor %} </details> <p> <a href="#" target="_blank" data-map-target="openLink">Ouvrir ailleurs</a> ou voir sur <button class="btn btn-sm btn-link" data-action="map#openInOsm">OSM</button> <button class="btn btn-sm btn-link" data-action="map#openInPanoramax">Panoramax</button> <button class="btn btn-sm btn-link" data-action="map#openInPifomap">Pifomap</button> <button class="btn btn-sm btn-link" data-action="map#openInPifometre">Pifomètre</button> <button class="btn btn-sm btn-link" data-action="map#openInGeohack">GeoHack</button> <button class="btn btn-sm btn-link" data-action="map#openInGeoportail">GéoPortail</button> <button class="btn btn-sm btn-link" data-action="map#openInF4Map">F4Map</button> <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInMapillary">Mapillary</button> <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInGoogleMaps">Google Maps</button> <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInBing">Bing</button> </p> </div> {% endmacro %} {# Génère le HTML qui va bien pour un bloc de texte que l’on peut copier dans le presse papier en cliquant simplement sur un bouton. Cf le controlleur Stimulus `clipboard` TODO Rajouter un retour visuel pour signifier que la copie a bien eu lieu serait pas du luxe… #} {% macro clipboard(text) %} <div class="input-group" data-controller="clipboard"> <input type="text" readonly class="form-control" value="{{ text }}" data-clipboard-target="source" /> <button class="btn btn-outline-secondary" type="button" data-action="clipboard#copy" title="Copier dans le presse-papier"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16"> <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/> <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/> </svg> </button> </div> {% endmacro %} {% macro osmLinkTo(user) %} <a href="{{ 'https://osm.org/user/' ~ user }}" target="_blank">{{ user }}</a> {% endmacro %}