2 Commits

Author SHA1 Message Date
  vincent ddb4630c64 ajoute des boutons de carte 1 month ago
  vincent 6087e21f68 composer update 1 month ago
5 changed files with 551 additions and 518 deletions
Unified View
  1. +13
    -1
      assets/controllers/map_controller.js
  2. +499
    -491
      composer.lock
  3. +19
    -11
      templates/macro.html.twig
  4. +15
    -13
      templates/project/show.html.twig
  5. +5
    -2
      templates/task/show.html.twig

+ 13
- 1
assets/controllers/map_controller.js View File

@ -32,7 +32,8 @@ export default class extends Controller {
'info': L.divIcon({ html: iconHtml, className: 'svg-icon text-info', iconSize: [16, 16], iconAnchor: [8, 16], }), 'info': L.divIcon({ html: iconHtml, className: 'svg-icon text-info', iconSize: [16, 16], iconAnchor: [8, 16], }),
}; };
var geojsons, _this = this, map = L.map(this.element);
var geojsons, _this = this, map = L.map(this.element.querySelector('#map'));
this.mapInstance = map;
// Commence par déclarer le fond de carte classique OSM par défaut // Commence par déclarer le fond de carte classique OSM par défaut
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
@ -158,4 +159,15 @@ export default class extends Controller {
// visibles // visibles
map.fitBounds(taskLayer.getBounds()); map.fitBounds(taskLayer.getBounds());
} }
openInOsm() {
const url = "https://www.openstreetmap.org/#map="+this.mapInstance.getZoom()+"/"+this.mapInstance.getCenter().lat+"/"+this.mapInstance.getCenter().lng;
window.open(url, '_blank');
}
openInPanoramax() {
const url = "https://api.panoramax.xyz/#focus=map&map="+this.mapInstance.getZoom()+"/"+this.mapInstance.getCenter().lat+"/"+this.mapInstance.getCenter().lng;
window.open(url, '_blank');
}
} }

+ 499
- 491
composer.lock
File diff suppressed because it is too large
View File


+ 19
- 11
templates/macro.html.twig View File

@ -32,8 +32,6 @@ Où :
#} #}
{% macro map(entity, overpassResult='') %} {% macro map(entity, overpassResult='') %}
<div <div
id="map"
class="img-fluid img-thumbnail min-vh-50"
data-controller="map" data-controller="map"
data-map-geojson-value="{{ geoJsonManager.generateGeoJson(entity)|json_encode }}" data-map-geojson-value="{{ geoJsonManager.generateGeoJson(entity)|json_encode }}"
{% if overpassResult is not empty %} {% if overpassResult is not empty %}
@ -41,15 +39,25 @@ Où :
data-map-popup-url-value={{ url('app_map_popup') }} data-map-popup-url-value={{ url('app_map_popup') }}
{% endif %} {% endif %}
data-map-icon-value="{{ asset('images/marker.svg') }}" data-map-icon-value="{{ asset('images/marker.svg') }}"
></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>
>
<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>
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>
</p>
</div>
{% endmacro %} {% endmacro %}
{# {#


+ 15
- 13
templates/project/show.html.twig View File

@ -101,20 +101,22 @@
{% endif %} {% endif %}
{% if comments is not empty %} {% if comments is not empty %}
<h2 class="mb-3">Commentaires</h2>
<div class="row">
<div class="col mb-3">
{% for comment in comments %}
<blockquote class="blockquote">
{{ comment.content|markdown_to_html }}
</blockquote>
<figcaption class="blockquote-footer">
{{ comment.task.name }}
{% include 'partials/_comment-metadata.html.twig' %}
</figcaption>
{% endfor %}
<details>
<summary class="mb-3"><h2 class="d-inline">Commentaires <span class="badge text-bg-secondary">{{ comments|length }}</span></h2></summary>
<div class="row">
<div class="col mb-3">
{% for comment in comments %}
<blockquote class="blockquote">
{{ comment.content|markdown_to_html }}
</blockquote>
<figcaption class="blockquote-footer">
{{ comment.task.name }}
{% include 'partials/_comment-metadata.html.twig' %}
</figcaption>
{% endfor %}
</div>
</div> </div>
</div>
</details>
{% endif %} {% endif %}
{% endblock %} {% endblock %}


+ 5
- 2
templates/task/show.html.twig View File

@ -135,7 +135,8 @@
{% if not (task.comments is empty or not is_granted('IS_AUTHENTICATED_FULLY')) %} {% if not (task.comments is empty or not is_granted('IS_AUTHENTICATED_FULLY')) %}
<h2 class="mb-3">Commentaires</h2>
<details>
<summary class="mb-3"><h2 class="d-inline">Commentaires <span class="badge text-bg-secondary">{{ task.comments|length }}</span></h2></summary>
{% endif %} {% endif %}
{% if task.comments is not empty %} {% if task.comments is not empty %}
<div class="row"> <div class="row">
@ -147,11 +148,13 @@
<figcaption class="blockquote-footer"> <figcaption class="blockquote-footer">
{% include 'partials/_comment-metadata.html.twig' %} {% include 'partials/_comment-metadata.html.twig' %}
</figcaption> </figcaption>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if not (task.comments is empty or not is_granted('IS_AUTHENTICATED_FULLY')) %}
</details>
{% endif %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %} {% if is_granted('IS_AUTHENTICATED_FULLY') %}
<div class="row"> <div class="row">
<div class="col mb-3"> <div class="col mb-3">


Loading…
Cancel
Save