You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
4.4 KiB

  1. {% macro paginated(entities, title, column) %}
  2. {{ knp_pagination_sortable(entities, title, column) }}
  3. {% if entities.isSorted(column) %}
  4. <span class="badge text-bg-secondary">
  5. {% if entities.params.direction == 'asc' %}
  6. <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">
  7. <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"/>
  8. <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"/>
  9. </svg>
  10. {% endif %}
  11. {% if entities.params.direction == 'desc' %}
  12. <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">
  13. <path d="M12.96 7H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645z"/>
  14. <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"/>
  15. <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"/>
  16. </svg>
  17. {% endif %}
  18. </span>
  19. {% endif %}
  20. {% endmacro %}
  21. {#
  22. Produit le HTML géré par le contrôleur Stimulus `map` et permet d’afficher une
  23. carte interactive
  24. Où :
  25. * `entity` peut être une instance de `Project` ou de `Task` pour représenter ce
  26. qu’il faut mapper
  27. * `overpassResult` est optionnel pour représenter ce qui est actuellement mappé
  28. #}
  29. {% macro map(entity, overpassResult='') %}
  30. <div
  31. data-controller="map"
  32. data-map-geojson-value="{{ geoJsonManager.generateGeoJson(entity)|json_encode }}"
  33. {% if overpassResult is not empty %}
  34. data-map-overpass-result-value="{{ overpassResult }}"
  35. data-map-popup-url-value={{ url('app_map_popup') }}
  36. {% endif %}
  37. data-map-icon-value="{{ asset('images/marker.svg') }}"
  38. >
  39. <div
  40. id="map"
  41. class="img-fluid img-thumbnail min-vh-50"
  42. ></div>
  43. <details>
  44. <summary>Légende</summary>
  45. <span class="badge bg-info">Overpass</span>
  46. {% set stats = taskLifecycleManager.getProjectStats(entity) %}
  47. {% for place, data in stats %}
  48. <span class="badge {{ 'bg-' ~ data.color }}">{{ data.title }}</span>
  49. {% endfor %}
  50. </details>
  51. <p>
  52. Voir sur
  53. <button class="btn btn-sm btn-link" data-action="map#openInOsm">OSM</button>
  54. <button class="btn btn-sm btn-link" data-action="map#openInPanoramax">Panoramax</button>
  55. <button class="btn btn-sm btn-link" data-action="map#openInPifomap">Pifomap</button>
  56. <button class="btn btn-sm btn-link" data-action="map#openInGeohack">GeoHack</button>
  57. <button class="btn btn-sm btn-link" data-action="map#openInGeoportail">GéoPortail</button>
  58. <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInMapillary">Mapillary</button>
  59. <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInGoogleMaps">Google Maps</button>
  60. <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInBing">Bing</button>
  61. </p>
  62. </div>
  63. {% endmacro %}
  64. {#
  65. Génère le HTML qui va bien pour un bloc de texte que l’on peut copier dans le
  66. presse papier en cliquant simplement sur un bouton.
  67. Cf le controlleur Stimulus `clipboard`
  68. TODO Rajouter un retour visuel pour signifier que la copie a bien eu lieu
  69. serait pas du luxe…
  70. #}
  71. {% macro clipboard(text) %}
  72. <div class="input-group" data-controller="clipboard">
  73. <input type="text" readonly class="form-control" value="{{ text }}" data-clipboard-target="source" />
  74. <button class="btn btn-outline-secondary" type="button" data-action="clipboard#copy" title="Copier dans le presse-papier">
  75. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
  76. <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"/>
  77. <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"/>
  78. </svg>
  79. </button>
  80. </div>
  81. {% endmacro %}