validation_report.html 3.83 KB
Newer Older
1
{% extends "base_template.html" %}
2 3 4
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
Pierre Dittgen's avatar
Pierre Dittgen committed
5 6 7 8 9 10
<style>
    .popover .popover-body h2 {
        font-size: 1.2em;
        font-weight: bold;
    }
</style>
11 12 13
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
14
<p class="text">Validation effectuée {{ validation_date }}</p>
15

Pierre Dittgen's avatar
Pierre Dittgen committed
16
{# Schema info #}
Pierre Dittgen's avatar
Pierre Dittgen committed
17
<div class="row">
Christophe Benz's avatar
Christophe Benz committed
18
    <div class="col-md-5 my-4">
Pierre Dittgen's avatar
Pierre Dittgen committed
19 20 21 22 23 24 25
        <div class="card bg-faded">
            <div class="card-body">
                <h5 class="card-title">
                    Schéma {{ val_info.code }}
                    <span class="badge badge-primary">{{ val_info.version }}</span>
                </h5>
                <h6 class="card-subtitle mb-2 text-muted">{{ val_info.description }}</h6>
Pierre Dittgen's avatar
Pierre Dittgen committed
26
                {% if val_info.author or val_info.contributor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
27
                <p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
28 29 30 31 32 33 34 35 36 37 38 39 40
                    {% if val_info.author %}
                    Auteur : {{ val_info.author }}
                    {% endif %}
                    {% if val_info.contributor %}
                    <br />Contributeur(s) : {{ val_info.contributor }}
                    {% endif %}
                </p>
                {% endif %}
                <p>
                    <a href="{{ val_info.docurl }}" target="_blank" class="card-link">Documentation</a>
                </p>
                <hr />
                <p class="text alert alert-info" style="margin-bottom: 0;">
41
                    Source
Pierre Dittgen's avatar
Pierre Dittgen committed
42 43
                    ({% if source_type == 'file' %}fichier{% endif %}{% if source_type == 'url' %}URL{% endif %})
                    : <em>{{ source.name }}</em>
44 45
                    <br />
                    Dimensions : <em>{{ report.table.col_count }} colonnes et {{ report.table.row_count }} lignes</em>
Pierre Dittgen's avatar
Pierre Dittgen committed
46 47 48
                </p>
            </div>
        </div>
49 50 51
    </div>
</div>

Pierre Dittgen's avatar
Pierre Dittgen committed
52
{% import 'table_macros.html' as tables %}
Pierre Dittgen's avatar
Pierre Dittgen committed
53

54
{% if report.error_count == 0 %}
55 56
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
57

Pierre Dittgen's avatar
Pierre Dittgen committed
58
{{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
59

60
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
61

62
<h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
63

64
{% if source_type == 'url' %}
Pierre Dittgen's avatar
Pierre Dittgen committed
65
<a class="btn btn-secondary my-2" href="{{ request.url }}">Relancer la validation</a>
66
{% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
67
{# table checks #}
Pierre Dittgen's avatar
Pierre Dittgen committed
68

69
{% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
70
<div>
71
    <h3>Problèmes de structure</h3>
72 73 74 75 76
    {% for err in report.table.errors.structure %}
    <div class="alert alert-danger">
        {{ err.message | safe}}
    </div>
    {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
77
</div>
78
{% endif %}
79

Pierre Dittgen's avatar
Pierre Dittgen committed
80
<!-- row checks -->
81

82 83 84 85 86 87 88 89 90 91
{% if not report.table.errors.body %}
<h3>Problèmes de contenu</h3>
<p class="text">
    Aucune erreur de contenu
</p>

{{ tables.preview(source_data) }}

{% endif %}

92
{% if report.table.errors.body %}
93 94

{% if not report.table.display_body_errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
95
<p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
96 97 98 99 100
    Veuillez corriger ce(s) erreur(s) pour visualiser les problèmes de contenu.
</p>

<p class="text">
    <a href="#" id="show_body_errors" title="">Affichez
Pierre Dittgen's avatar
Pierre Dittgen committed
101
        tout de même les problèmes de contenu</a>
Pierre Dittgen's avatar
Pierre Dittgen committed
102
</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
103 104 105 106 107
<div class="alert alert-warning">
    Attention, en cas de problèmes de structure signalés ci-dessus, certains messages d'erreurs ne seront pas
    pertinents
</div>

Pierre Dittgen's avatar
Pierre Dittgen committed
108 109 110
<div id="body_errors" style="display: none">
    {{ tables.body_errors(report, source_data) }}
</div>
111
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
112
<div>
Pierre Dittgen's avatar
Pierre Dittgen committed
113
    {{ tables.body_errors(report, source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
114
</div>
Pierre Dittgen's avatar
Pierre Dittgen committed
115 116 117
{% endif %}
{% endif %}

118

Pierre Dittgen's avatar
Pierre Dittgen committed
119
{% endif %}
120 121
{% endblock %}
{% block footer %}
122 123
<script>
    $(function () {
124
        // Errors tooltip activate
Pierre Dittgen's avatar
Pierre Dittgen committed
125 126 127
        $('[data-toggle="popover"]').popover({
            html: true,
            placement: 'auto',
128
            trigger: 'hover'
Pierre Dittgen's avatar
Pierre Dittgen committed
129
        });
130

Pierre Dittgen's avatar
Pierre Dittgen committed
131 132 133 134
        // Show body errors
        $('#show_body_errors').on('click', function () {
            $('#body_errors').show();
            $(this).remove();
135
        })
136 137
    })
</script>
138 139 140 141 142 143

{#
{{ report.table.errors.structure|length }} erreur(s) détectée(s)
{{ report.table.errors.body|length }} erreur(s) détectée(s)

#}
Pierre Dittgen's avatar
Pierre Dittgen committed
144
{% endblock %}