Browse Source

introduit les changesets

master
vincent 4 months ago
parent
commit
362eb59d70
2 changed files with 57 additions and 1 deletions
  1. +21
    -0
      src/Twig/AppExtension.php
  2. +36
    -1
      templates/task/show.html.twig

+ 21
- 0
src/Twig/AppExtension.php View File

@ -0,0 +1,21 @@
<?php
namespace App\Twig;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class AppExtension extends AbstractExtension
{
public function getFilters(): array
{
return [
new TwigFilter('json_decode', [$this, 'jsonDecode']),
];
}
public function jsonDecode(string $value)
{
return json_decode($value, true);
}
}

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

@ -68,7 +68,7 @@
</div>
{% endif %}
{% if workflow_metadata(task, 'locking', task.status) %}
{% if task.status == 'doing' %}
<div class="row">
<div class="col mb-3">
<table class="table table-bordered table-sm">
@ -94,6 +94,41 @@
</div>
{% endif %}
{% if task.status == 'done' and task.changesetsResult is not empty %}
<div class="row">
<div class="col mb-3">
<div class="accordion" id="changsetsAccordion">
{% set changesets = task.changesetsResult|json_decode %}
{% for changeset in changesets %}
{% set collapseId = 'collapse' ~ loop.index %}
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="{{ '#' ~ collapseId }}" aria-expanded="false" aria-controls="{{ collapseId }}">
{{ 'Groupe de modifications ' ~ changeset.id }}
</button>
</h2>
<div id="{{ collapseId }}" class="accordion-collapse collapse" data-bs-parent="#changesetsAccordion">
<div class="accordion-body">
<p> Voir sur <a href="{{ 'https://www.openstreetmap.org/changeset/' ~ changeset.id }}" target="_blank">OSM</a> ou <a href="{{ 'https://osmcha.org/changesets/' ~ changeset.id }}" target="_blank">OSMCha</a></p>
<table class="table table-bordered table-sm">
<tbody>
{% for key, value in changeset %}
<tr>
<th scope="row">{{ key }}</th>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
<h2 class="mb-3">Carte</h2>
<div class="row">
<div class="col mb-3">


Loading…
Cancel
Save