validation_report.html 3.73 KB
Newer Older
1
{% extends "base_template.html" %}
2 3 4 5 6 7
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
8
<p class="text">Validation effectuée {{ validation_date }}</p>
9

Pierre Dittgen's avatar
Pierre Dittgen committed
10
{# Schema info #}
Pierre Dittgen's avatar
Pierre Dittgen committed
11
<div class="row">
Christophe Benz's avatar
Christophe Benz committed
12
    <div class="col-md-5 my-4">
Pierre Dittgen's avatar
Pierre Dittgen committed
13 14 15 16 17 18 19
        <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
20
                {% if val_info.author or val_info.contributor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
21
                <p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
22 23 24 25 26 27 28 29 30 31 32 33 34
                    {% 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;">
35
                    Source
Pierre Dittgen's avatar
Pierre Dittgen committed
36
                        ({% if source_type == 'file' %}fichier{% endif %}{% if source_type == 'url' %}URL{% endif %})
37 38 39
                        : <em>{{ source.name }}</em>
                    <br />
                    Dimensions : <em>{{ report.table.col_count }} colonnes et {{ report.table.row_count }} lignes</em>
Pierre Dittgen's avatar
Pierre Dittgen committed
40 41 42
                </p>
            </div>
        </div>
43 44 45
    </div>
</div>

Pierre Dittgen's avatar
Pierre Dittgen committed
46
{% import 'table_macros.html' as tables %}
Pierre Dittgen's avatar
Pierre Dittgen committed
47

48
{% if report.error_count == 0 %}
49 50
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
51

Pierre Dittgen's avatar
Pierre Dittgen committed
52
{{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
53

54
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
55

56
<h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
57

58
{% if source_type == 'url' %}
Pierre Dittgen's avatar
Pierre Dittgen committed
59
<a class="btn btn-secondary my-2" href="{{ request.url }}">Relancer la validation</a>
60
{% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
61
{# table checks #}
Pierre Dittgen's avatar
Pierre Dittgen committed
62

63
{% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
64
<div>
65
    <h3>Problèmes de structure</h3>
66 67 68 69 70
    {% for err in report.table.errors.structure %}
    <div class="alert alert-danger">
        {{ err.message | safe}}
    </div>
    {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
71
</div>
72
{% endif %}
73

Pierre Dittgen's avatar
Pierre Dittgen committed
74
<!-- row checks -->
75

76 77 78 79 80 81 82 83 84 85 86
{% 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 %}

{% if report.table.errors.body %}
87 88

{% if not report.table.display_body_errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
89
<p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
90 91 92 93 94
    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
95
        tout de même les problèmes de contenu</a>
Pierre Dittgen's avatar
Pierre Dittgen committed
96
</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
97 98 99 100 101
<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
102 103 104
<div id="body_errors" style="display: none">
    {{ tables.body_errors(report, source_data) }}
</div>
105
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
106
<div>
Pierre Dittgen's avatar
Pierre Dittgen committed
107
    {{ tables.body_errors(report, source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
108
</div>
Pierre Dittgen's avatar
Pierre Dittgen committed
109 110 111
{% endif %}
{% endif %}

112

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

Pierre Dittgen's avatar
Pierre Dittgen committed
125 126 127 128
        // Show body errors
        $('#show_body_errors').on('click', function () {
            $('#body_errors').show();
            $(this).remove();
129
        })
130 131
    })
</script>
132 133 134

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

#}
138
{% endblock %}