Browse Source

ajoute quelques bricoles

master
vincent 4 months ago
parent
commit
b1b46119c3
6 changed files with 21 additions and 3 deletions
  1. +1
    -0
      .env
  2. +5
    -1
      assets/controllers/map_controller.js
  3. +2
    -1
      config/services.yaml
  4. +6
    -0
      src/Kernel.php
  5. +6
    -0
      templates/partials/_overpass-element-popup.html.twig
  6. +1
    -1
      templates/task/show.html.twig

+ 1
- 0
.env View File

@ -29,5 +29,6 @@ DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" # DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###
APP_TIMEZONE=
OSM_CLIENT_ID= OSM_CLIENT_ID=
OSM_CLIENT_SECRET= OSM_CLIENT_SECRET=

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

@ -55,6 +55,10 @@ export default class extends Controller {
layer2.on('popupopen', function (event) { layer2.on('popupopen', function (event) {
var element = event.popup.options.overpassElement; var element = event.popup.options.overpassElement;
delete element.members; delete element.members;
element['map'] = {
'center': map.getCenter(),
'zoom': map.getZoom(),
};
fetch(_this.popupUrlValue + '?' + (new URLSearchParams({ fetch(_this.popupUrlValue + '?' + (new URLSearchParams({
'element': JSON.stringify(element), 'element': JSON.stringify(element),
}))) })))
@ -111,6 +115,6 @@ export default class extends Controller {
}).addTo(map); }).addTo(map);
} }
map.fitBounds(layer.getBounds());
map.fitBounds(layer1.getBounds());
} }
} }

+ 2
- 1
config/services.yaml View File

@ -4,7 +4,8 @@
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters: parameters:
timezone: '%env(APP_TIMEZONE)%'
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
_defaults: _defaults:


+ 6
- 0
src/Kernel.php View File

@ -8,4 +8,10 @@ use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
public function boot(): void
{
parent::boot();
date_default_timezone_set($this->getContainer()->getParameter('timezone'));
}
} }

+ 6
- 0
templates/partials/_overpass-element-popup.html.twig View File

@ -1,6 +1,12 @@
<h6>{{ element.type|capitalize }} {{ element.id }}</h6> <h6>{{ element.type|capitalize }} {{ element.id }}</h6>
<p>Voir sur <a href="https://www.openstreetmap.org/{{ element.type }}/{{ element.id }}" target="_blank">OSM</a> <p>Voir sur <a href="https://www.openstreetmap.org/{{ element.type }}/{{ element.id }}" target="_blank">OSM</a>
<br/>sur <a href="https://api.panoramax.xyz/#focus=map&map={{ element.map.zoom }}/{{ element.map.center.lat }}/{{ element.map.center.lng }}" target="_blank">Panoramax<a>
{% if element.type == 'relation' and element.tags and element.tags.route and element.tags.route == 'hiking' %} {% if element.type == 'relation' and element.tags and element.tags.route and element.tags.route == 'hiking' %}
<br/>sur <a href="https://hiking.waymarkedtrails.org/#route?id={{ element.id }}&type=relation" target="_blank">WayMarkedTrails</a> <br/>sur <a href="https://hiking.waymarkedtrails.org/#route?id={{ element.id }}&type=relation" target="_blank">WayMarkedTrails</a>
{% endif %} {% endif %}
<table><tbody>
{% for key, value in element.tags %}
<tr><th>{{ key }}</th><td>{{ value }}</td></tr>
{% endfor %}
</tbody></table>
</p> </p>

+ 1
- 1
templates/task/show.html.twig View File

@ -82,7 +82,7 @@
<h2 class="mb-3">Carte</h2> <h2 class="mb-3">Carte</h2>
<div class="row"> <div class="row">
<div class="col mb-3"> <div class="col mb-3">
{{ macro.map(task) }}
{{ macro.map(task, task.project.overpassResult) }}
</div> </div>
</div> </div>


Loading…
Cancel
Save