Commit cc96ef18 authored by Pierre Dittgen's avatar Pierre Dittgen

Add catalog descriptions on home page

parent b58cb4ed
......@@ -3,11 +3,31 @@
{
"name": "scdl",
"title": "Socle Commun des Données Locales",
"description": "Ces schémas sont portés par OpenDataFrance et respectent un standard de qualité en terme de documentation.",
"catalog": "https://git.opendatafrance.net/scdl/catalog/raw/master/catalog.json"
},
{
"name": "draft",
"title": "Autres schémas",
"description": "Ces schémas ont été identifiés comme proches du SCDL, ils ne sont cependant pas gérés par OpenDataFrance.",
"catalog": {
"version": 1,
"schemas": [
{
"name": "lieux-covoiturage",
"repo_url": "https://github.com/etalab/schema-lieux-covoiturage"
},
{
"name": "decp-dpa",
"repo_url": "https://github.com/etalab/schema-decp-dpa"
}
]
}
},
{
"name": "external",
"title": "Validateurs externes",
"description": "Sélection d'outils de validation de données complémentaires à Validata.",
"links": [
{
"name": "inspire",
......
{% extends "base_template.html" %}
{% block head %}
{{ super() }}
<style>
div.mb-5 h2.my-4, div.my-5 h2.my-4 {
margin-bottom: 0.2em !important;
}
</style>
{% endblock %}
{% block title %}Accueil{% endblock %}
{% block content %}
......@@ -8,6 +17,9 @@
{% if section.catalog %}
<div class="mb-5">
<h2 class="my-4">{{ section.title }}</h2>
{% if section.description %}
<p class="text-muted">{{ section.description }}</p>
{% endif %}</h2>
<form action="{{ url_for('custom_validator') }}" method="GET">
<div class="form-row">
<div class="form-group col-lg-9">
......@@ -28,7 +40,8 @@
{% endfor %}
<div class="my-5">
<h2 class="my-4">Autre schéma</h2>
<h2 class="my-4">Schéma à la carte</h2>
<p class="text-muted">Indiquez ici l'URL du schéma que vous souhaitez pour valider un fichier.</p>
<form action="{{ url_for('custom_validator') }}" data-cy="custom_schema_form" method="GET">
<div class="form-row">
<div class="form-group col-lg-9">
......@@ -57,6 +70,9 @@
{% if section.links %}
<div class="my-5">
<h2 class="my-4">{{ section.title }}</h2>
{% if section.description %}
<p class="text-muted">{{ section.description}}</p>
{% endif %}
<div class="row my-4">
{% for item in section.links %}
<div class="col-sm-4 mb-4">
......@@ -69,8 +85,7 @@
class="btn btn-outline-secondary mt-auto"
>Utiliser
<i class="fas fa-external-link-alt ml-1"></i>
</a
>
</a>
</div>
</div>
</div>
......
......@@ -437,7 +437,7 @@ def home():
if not config.HOMEPAGE_CONFIG:
return
for section in config.HOMEPAGE_CONFIG['sections']:
home_section = {"name": section['name'], "title": section["title"]}
home_section = {k: v for k, v in section.items() if k != 'catalog'}
if "catalog" in section:
schema_catalog = get_schema_catalog(section['name'])
if schema_catalog:
......@@ -447,7 +447,7 @@ def home():
table_schema = tableschema_from_url(schema_reference.get_schema_url())
home_section_catalog.append({
"name": schema_reference.name,
"title": table_schema.descriptor.get("title") or schema_reference.name
"title": table_schema.descriptor.get("title") or schema_reference.name,
})
home_section['catalog'] = home_section_catalog
if "links" in section:
......
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