Browse Source

ajoute des boutons de carte

master
vincent 2 weeks ago
parent
commit
ddb4630c64
4 changed files with 52 additions and 27 deletions
  1. +13
    -1
      assets/controllers/map_controller.js
  2. +19
    -11
      templates/macro.html.twig
  3. +15
    -13
      templates/project/show.html.twig
  4. +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], }),
};
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
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
@ -158,4 +159,15 @@ export default class extends Controller {
// visibles
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');
}
}

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

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


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

@ -101,20 +101,22 @@
{% endif %}
{% 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>
</details>
{% endif %}
{% 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')) %}
<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 %}
{% if task.comments is not empty %}
<div class="row">
@ -147,11 +148,13 @@
<figcaption class="blockquote-footer">
{% include 'partials/_comment-metadata.html.twig' %}
</figcaption>
{% endfor %}
</div>
</div>
{% endif %}
{% if not (task.comments is empty or not is_granted('IS_AUTHENTICATED_FULLY')) %}
</details>
{% endif %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
<div class="row">
<div class="col mb-3">


Loading…
Cancel
Save