Commit e5d0abd3 authored by Christophe Benz's avatar Christophe Benz

Display table out of container

parent 6be3cbdc
......@@ -69,7 +69,7 @@
{% endwith %}
<!-- main content -->
<div id="content" class="container">
<div id="content">
{% block content %}{% endblock %}
</div>
......
......@@ -3,7 +3,7 @@
{% block title %}Accueil{% endblock %}
{% block content %}
<div class="container">
{% for section in config.sections %}
{% if section.catalog %}
<div class="mb-5">
......@@ -80,4 +80,5 @@
{% endif %}
{% endfor %}
</div>
{% endblock %}
......@@ -5,82 +5,84 @@
{% block title %}{{ section_title }} – {{ schema_info.title }}{% endblock %}
{% block content %}
<div class="row my-4">
<div class="col-lg-6 mb-4">
<div class="card">
<div class="card-body">
{{ schema_info_macros.html(schema_info, branches, tags, schema_current_version, doc_url) }}
<div class="container">
<div class="row my-4">
<div class="col-lg-6 mb-4">
<div class="card">
<div class="card-body">
{{ schema_info_macros.html(schema_info, branches, tags, schema_current_version, doc_url) }}
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="file-tab" data-toggle="tab" href="#file" role="tab" aria-controls="file"
aria-selected="true">Fichier</a>
</li>
<li class="nav-item">
<a class="nav-link" id="url-tab" data-toggle="tab" href="#url" role="tab" aria-controls="url"
aria-selected="false">URL</a>
</li>
{% if schema_info.resources %}
<li class="nav-item">
<a class="nav-link" id="examples-tab" data-toggle="tab" href="#example" role="tab"
aria-controls="examples" aria-selected="false">Exemples</a>
</li>
{% endif %}
</ul>
{% set padding_class = 'p-3' %}
<div class="tab-content" id="myTabContent">
<div class="tab-pane show active {{ padding_class }}" id="file" role="tabpanel" aria-labelledby="file-tab">
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="input" value="file" />
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<input required type="file" class="form-control-file" name="file" id="file" accept=".csv, .xls, .xlsx, .ods" aria-describedby="fileHelpBlock" />
<small id="fileHelpBlock" class="form-text text-muted">
Exemple : .xlsx, .xls, .ods, .csv, .tsv, etc.
</small>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
</div>
<div class="tab-pane {{ padding_class }}" id="url" role="tabpanel" aria-labelledby="url-tab">
<form method="GET">
<input type="hidden" name="input" value="url" />
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<input required name="url" type="url" class="form-control" id="url" aria-describedby="urlHelpBlock" placeholder="https://example.com/file.csv" />
<small id="urlHelpBlock" class="form-text text-muted">
Exemple : .xlsx, .xls, .ods, .csv, .tsv, etc.
</small>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
</div>
{% if schema_info.resources %}
<div class="tab-pane {{ padding_class }}" id="example" role="tabpanel" aria-labelledby="examples-tab">
<form method="GET">
<input name="input" value="example" type="hidden">
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<select required name="url" id="url" class="form-control">
<option selected disabled value="">Choisissez un fichier tabulaire d'exemple</option>
{% for res in schema_info.resources %}
<option value="{{ res.path }}">{{ res.title }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
<div class="col-lg-6">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="file-tab" data-toggle="tab" href="#file" role="tab" aria-controls="file"
aria-selected="true">Fichier</a>
</li>
<li class="nav-item">
<a class="nav-link" id="url-tab" data-toggle="tab" href="#url" role="tab" aria-controls="url"
aria-selected="false">URL</a>
</li>
{% if schema_info.resources %}
<li class="nav-item">
<a class="nav-link" id="examples-tab" data-toggle="tab" href="#example" role="tab"
aria-controls="examples" aria-selected="false">Exemples</a>
</li>
{% endif %}
</ul>
{% set padding_class = 'p-3' %}
<div class="tab-content" id="myTabContent">
<div class="tab-pane show active {{ padding_class }}" id="file" role="tabpanel" aria-labelledby="file-tab">
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="input" value="file" />
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<input required type="file" class="form-control-file" name="file" id="file" accept=".csv, .xls, .xlsx, .ods" aria-describedby="fileHelpBlock" />
<small id="fileHelpBlock" class="form-text text-muted">
Exemple : .xlsx, .xls, .ods, .csv, .tsv, etc.
</small>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
</div>
<div class="tab-pane {{ padding_class }}" id="url" role="tabpanel" aria-labelledby="url-tab">
<form method="GET">
<input type="hidden" name="input" value="url" />
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<input required name="url" type="url" class="form-control" id="url" aria-describedby="urlHelpBlock" placeholder="https://example.com/file.csv" />
<small id="urlHelpBlock" class="form-text text-muted">
Exemple : .xlsx, .xls, .ods, .csv, .tsv, etc.
</small>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
</div>
{% if schema_info.resources %}
<div class="tab-pane {{ padding_class }}" id="example" role="tabpanel" aria-labelledby="examples-tab">
<form method="GET">
<input name="input" value="example" type="hidden">
{% for key, value in schema_params.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}" />
{% endfor %}
<div class="form-group">
<select required name="url" id="url" class="form-control">
<option selected disabled value="">Choisissez un fichier tabulaire d'exemple</option>
{% for res in schema_info.resources %}
<option value="{{ res.path }}">{{ res.title }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary">Valider le fichier</button>
</form>
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
......
......@@ -26,16 +26,17 @@
{% endblock %}
{% block content %}
<div class="container">
<p class="text-muted">Validation effectuée {{ validation_date }}</p>
<p class="text-muted">Validation effectuée {{ validation_date }}</p>
{% if source.type == 'url' %}
<p class="hidden-print">
<a class="btn btn-outline-secondary" href="{{ pdf_report_url }}&url={{source.url|urlencode}}" target="_blank">
Télécharger en PDF
</a>
</p>
{% endif %}
{% if source.type == 'url' %}
<p class="hidden-print">
<a class="btn btn-outline-secondary" href="{{ pdf_report_url }}&url={{source.url|urlencode}}" target="_blank">
Télécharger en PDF
</a>
</p>
{% endif %}
{# Schema info #}
<div class="row my-4">
......@@ -87,85 +88,69 @@
</div>
</div>
{% if report.error_count == 0 %}
{{ macros.preview(source_data) }}
{% else %}
{% if report.table.errors.structure %}
<h3 class="my-4">Erreurs de structure</h3>
{# Non-column errors #}
{% for err in report.table.errors.structure %}
{% if not err.in_column_comp %}
{{ err.content | safe }}
{% endif %}
{% endfor %}
{% if report.error_count > 0 %}
{% if report.table.errors.structure %}
<h3 class="my-4">Erreurs de structure</h3>
{# Non-column errors #}
{% for err in report.table.errors.structure %}
{% if not err.in_column_comp %}
{{ err.content | safe }}
{% endif %}
{% endfor %}
{# Column errors #}
{% for err in report.table.errors.structure %}
{% if err.in_column_comp %}
{{ err.content | safe }}
{% endif %}
{% endfor %}
{# Afficher un tableau de comparaison des colonnes #}
{% if report.table.column_comparison_needed %}
<table class="table table-bordered table-sm table-striped table-hover">
<thead class="thead-light">
<tr>
<th scope="col">Colonnes du fichier</th>
<th scope="col">Colonnes attendues</th>
</tr>
</thead>
<tbody>
{% for elt in report.table.column_comparison_info.table %}
<tr{% if elt[2] == 'ko' %} class="table-danger"{% endif %}>
<td>{{ elt[0] }}</td>
<td>{{ elt[1] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if report.table.column_comparison_info.has_missing %}
<p>Attention : toutes les colonnes attendues doivent être présentes dans le fichier à valider.<p>
{% endif %}
{% if report.table.column_comparison_info.has_case_errors %}
<p>Attention : la casse (minuscules/majuscules) doit être respectée dans les noms de colonne.<p>
{% endif %}
{# Column errors #}
{% for err in report.table.errors.structure %}
{% if err.in_column_comp %}
{{ err.content | safe }}
{% endif %}
{% endfor %}
{# Afficher un tableau de comparaison des colonnes #}
{% if report.table.column_comparison_needed %}
<table class="table table-bordered table-sm table-striped table-hover">
<thead class="thead-light">
<tr>
<th scope="col">Colonnes du fichier</th>
<th scope="col">Colonnes attendues</th>
</tr>
</thead>
<tbody>
{% for elt in report.table.column_comparison_info.table %}
<tr{% if elt[2] == 'ko' %} class="table-danger"{% endif %}>
<td>{{ elt[0] }}</td>
<td>{{ elt[1] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if report.table.column_comparison_info.has_missing %}
<p>Attention : toutes les colonnes attendues doivent être présentes dans le fichier à valider.<p>
{% endif %}
{% if report.table.column_comparison_info.has_case_errors %}
<p>Attention : la casse (minuscules/majuscules) doit être respectée dans les noms de colonne.<p>
{% endif %}
{% endif %}
{% endif %}
{# We do display body errors! #}
{% if report.table.do_display_body_errors %}
<h3 class="my-4">Erreurs de contenu</h3>
{# No errors - display preview #}
{% if not report.table.errors.body %}
<p>
Aucune erreur de contenu
</p>
{{ macros.preview(source_data) }}
{% else %}
{# display errors #}
{{ macros.body_errors(report, source_data, print_mode) }}
{% endif %}
{# do not display errors #}
{% else %}
<p>
Veuillez corriger ces erreurs pour visualiser les éventuelles erreurs de contenu.
</p>
{% endif %}
{% endif %}
{% endblock %}
</div>
{% if report.table.do_display_body_errors %} {# We do display body errors! #}
<div class="mx-4">
{% if report.table.errors.body %}
<h3 class="my-4">Erreurs de contenu</h3>
{{ macros.body_errors(report, source_data, print_mode) }}
{% else %}
{{ macros.preview(source_data) }}
{% endif %}
</div>
{% else %} {# do not display errors #}
<p>Veuillez corriger ces erreurs pour visualiser les éventuelles erreurs de contenu.</p>
{% endif %}
{% endblock %}
{% block page_scripts %}
<script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment