ajout grammalecte

This commit is contained in:
Tykayn 2025-09-01 11:38:19 +02:00 committed by tykayn
parent e61d932565
commit 471eab4cd0
8 changed files with 45296 additions and 283 deletions

View file

@ -111,10 +111,13 @@
{% if fr_page is defined and fr_page is not null %}
{% if detailed_comparison is defined and detailed_comparison is not null and detailed_comparison.grammar_suggestions is defined and detailed_comparison.grammar_suggestions is not null and detailed_comparison.grammar_suggestions|length > 0 %}
{% if fr_page is defined and fr_page is not null and fr_page.grammar_suggestions is defined and fr_page.grammar_suggestions is not null and fr_page.grammar_suggestions|length > 0 %}
<div class="card mb-4">
<div class="card-header">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>Suggestions de corrections grammaticales</h2>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#allCorrectionsModal">
Voir toutes les corrections
</button>
</div>
<div class="card-body">
<div class="alert alert-info">
@ -125,17 +128,19 @@
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Contexte</th>
<th>Texte</th>
<th>Message</th>
<th>Suggestions</th>
</tr>
</thead>
<tbody>
{% for suggestion in detailed_comparison.grammar_suggestions %}
{% for suggestion in fr_page.grammar_suggestions|slice(0, 5) %}
<tr>
<td>
{% if suggestion.context is defined %}
<code>{{ suggestion.context }}</code>
{% if suggestion.before is defined and suggestion.text is defined and suggestion.after is defined %}
<code>{{ suggestion.before|slice(-20)|trim }}
<span class="text-danger">{{ suggestion.text }}</span>
{{ suggestion.after|slice(0, 20)|trim }}</code>
{% endif %}
</td>
<td>
@ -145,11 +150,16 @@
</td>
<td>
{% if suggestion.suggestions is defined and suggestion.suggestions is iterable and suggestion.suggestions|length > 0 %}
<ul class="list-unstyled mb-0">
{% for correction in suggestion.suggestions %}
<li><code>{{ correction }}</code></li>
{% endfor %}
</ul>
<div class="dropdown">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" id="dropdownMenuButton{{ loop.index }}" data-bs-toggle="dropdown" aria-expanded="false">
Suggestions ({{ suggestion.suggestions|length }})
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton{{ loop.index }}">
{% for correction in suggestion.suggestions %}
<li><a class="dropdown-item" href="#">{{ correction }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<span class="text-muted">Aucune suggestion</span>
{% endif %}
@ -158,6 +168,132 @@
{% endfor %}
</tbody>
</table>
{% if fr_page.grammar_suggestions|length > 5 %}
<div class="text-center mt-3">
<p>{{ fr_page.grammar_suggestions|length - 5 }} suggestions supplémentaires disponibles</p>
</div>
{% endif %}
</div>
</div>
</div>
<!-- Modal for all corrections -->
<div class="modal fade" id="allCorrectionsModal" tabindex="-1" aria-labelledby="allCorrectionsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="allCorrectionsModalLabel">Toutes les suggestions de corrections</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Texte</th>
<th>Message</th>
<th>Suggestions</th>
</tr>
</thead>
<tbody>
{% for suggestion in fr_page.grammar_suggestions %}
<tr>
<td>
{% if suggestion.before is defined and suggestion.text is defined and suggestion.after is defined %}
<code>{{ suggestion.before|slice(-30)|trim }}
<span class="text-danger">{{ suggestion.text }}</span>
{{ suggestion.after|slice(0, 30)|trim }}</code>
{% endif %}
</td>
<td>
{% if suggestion.message is defined %}
{{ suggestion.message }}
{% endif %}
</td>
<td>
{% if suggestion.suggestions is defined and suggestion.suggestions is iterable and suggestion.suggestions|length > 0 %}
<div class="dropdown">
<button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" id="modalDropdownMenuButton{{ loop.index }}" data-bs-toggle="dropdown" aria-expanded="false">
Suggestions ({{ suggestion.suggestions|length }})
</button>
<ul class="dropdown-menu" aria-labelledby="modalDropdownMenuButton{{ loop.index }}">
{% for correction in suggestion.suggestions %}
<li><a class="dropdown-item" href="#">{{ correction }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<span class="text-muted">Aucune suggestion</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
</div>
</div>
</div>
</div>
{% endif %}
{% if fr_page is defined and fr_page is not null and fr_page.categories is defined and (fr_page.categories|length == 0) and en_page is defined and en_page.categories is defined and (en_page.categories|length > 0) %}
<div class="card mb-4">
<div class="card-header bg-warning text-dark">
<h2>Suggestion d'ajout de catégories</h2>
</div>
<div class="card-body">
<div class="alert alert-warning">
<p><i class="bi bi-exclamation-triangle"></i> <strong>La page française ne contient aucune catégorie.</strong></p>
<p>Les catégories aident à organiser les pages wiki et à les rendre plus facilement découvrables. Considérez ajouter les catégories suivantes de la page anglaise :</p>
</div>
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-primary text-white">
<h3>Catégories suggérées</h3>
</div>
<div class="card-body">
<ul class="list-group">
{% for category in en_page.categories %}
<li class="list-group-item">
{{ category }}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header bg-info text-white">
<h3>Comment ajouter des catégories</h3>
</div>
<div class="card-body">
<p>Pour ajouter des catégories à la page wiki :</p>
<ol>
<li>Éditez la page française sur le wiki OSM</li>
<li>Ajoutez les catégories à la fin de la page en utilisant la syntaxe suivante :</li>
</ol>
<div class="bg-light p-3 mb-3">
<code>
[[Category:Nom de la catégorie]]<br>
[[Category:Autre catégorie]]
</code>
</div>
<p>Vous pouvez également utiliser l'interface d'édition du wiki pour ajouter des catégories.</p>
<div class="d-grid gap-2 mt-3">
<a href="{{ fr_page.url }}" target="_blank" class="btn btn-primary">
<i class="bi bi-pencil-square"></i> Éditer la page française
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>