Commit 4344d3a5 authored by Pierre Dittgen's avatar Pierre Dittgen

Add popover to valid data preview

parent ba56641e
{% macro preview(source_data) %}
{% macro preview(report, source_data) %}
<p>
Prévisualisation de {{ source_data.preview_rows_nb }} ligne{% if source_data.preview_rows_nb > 1 %}s{% endif %} sur {{ source_data.rows_nb }} au total :
</p>
......@@ -6,9 +6,10 @@
<table class="table table-striped table-bordered table-sm table-hover">
<thead class="thead-light">
<tr>
{% for col in source_data.header %}
<th scope="col">{{ col }}</th>
{% endfor %}
{% for h in source_data.header %}
<th scope="col" data-toggle="popover" title="{{ report.table.headers_title[loop.index - 1]}}" data-content="{{ report.table.headers_description[loop.index - 1] | commonmark2html | escape}}">{{
h }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
......
......@@ -222,7 +222,7 @@ def create_validata_ui_report(validata_core_report, schema_dict):
report['table']['col_count'] = len(headers)
# Computes column info
fields_dict = {f['name']: (f.get('title', 'titre non défini'), f.get('description', ''))
fields_dict = {f['name']: (f.get('title', f['name']), f.get('description', ''))
for f in schema_dict.get('fields', [])}
report['table']['headers_title'] = [fields_dict[h][0] if h in fields_dict else 'colonne inconnue' for h in headers]
report['table']['headers_description'] = [fields_dict[h][1]
......
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