wiki illustrations et team osm fr

This commit is contained in:
Tykayn 2025-08-31 23:15:03 +02:00 committed by tykayn
parent d7a54458dc
commit 77ad76cc7e
13 changed files with 78859 additions and 13414 deletions

View file

@ -18,6 +18,7 @@
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th rowspan="2">Image</th>
<th rowspan="2">Clé</th>
<th colspan="4" class="text-center">Différences FR vs EN</th>
<th rowspan="2" class="text-center">Score de<br>décrépitude</th>
@ -34,6 +35,11 @@
{% for key, languages in wiki_pages %}
{% if languages['en'] is defined and languages['fr'] is defined %}
<tr>
<td>
<img src="{{ languages['en'].description_img_url }}" alt="image" style="height: 2rem;">
</td>
<td>
<strong>{{ key }}</strong>
</td>
@ -147,7 +153,8 @@
<i class="bi bi-flag-fill"></i> EN
</a>
<a href="{{ path('app_admin_wiki_create_french', {'key': key}) }}"
class="btn btn-sm btn-outline-primary" title="Créer une traduction française">
class="btn btn-sm btn-outline-primary"
title="Créer une traduction française">
<i class="bi bi-translate"></i> créer FR
</a>
{# <a href="{{ path('app_admin_wiki_compare', {'key': key}) }}" #}
@ -187,43 +194,43 @@
{{ parent() }}
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
// Collect data from the table
const labels = [];
const scores = [];
const colors = [];
{% for key, languages in wiki_pages %}
{% if languages['en'] is defined and languages['fr'] is defined %}
labels.push("{{ key }}");
{% set score = languages['en'].staleness_score|default(0) %}
scores.push({{ score }});
// Set color based on score
{% if score > 50 %}
colors.push('rgba(220, 53, 69, 0.7)'); // danger
{% elseif score > 20 %}
colors.push('rgba(255, 193, 7, 0.7)'); // warning
{% else %}
colors.push('rgba(25, 135, 84, 0.7)'); // success
{% endif %}
{% endif %}
{% if languages['en'] is defined and languages['fr'] is defined %}
labels.push("{{ key }}");
{% set score = languages['en'].staleness_score|default(0) %}
scores.push({{ score }});
// Set color based on score
{% if score > 50 %}
colors.push('rgba(220, 53, 69, 0.7)'); // danger
{% elseif score > 20 %}
colors.push('rgba(255, 193, 7, 0.7)'); // warning
{% else %}
colors.push('rgba(25, 135, 84, 0.7)'); // success
{% endif %}
{% endif %}
{% endfor %}
// Sort data by score (descending)
const indices = Array.from(Array(scores.length).keys())
.sort((a, b) => scores[b] - scores[a]);
const sortedLabels = indices.map(i => labels[i]);
const sortedScores = indices.map(i => scores[i]);
const sortedColors = indices.map(i => colors[i]);
// Limit to top 20 pages for readability
const displayLimit = 20;
const displayLabels = sortedLabels.slice(0, displayLimit);
const displayScores = sortedScores.slice(0, displayLimit);
const displayColors = sortedColors.slice(0, displayLimit);
// Create the chart
const ctx = document.getElementById('decrepitudeChart').getContext('2d');
new Chart(ctx, {
@ -247,7 +254,7 @@
},
tooltip: {
callbacks: {
label: function(context) {
label: function (context) {
return `Score: ${context.raw}`;
}
}