Commit cc96ef18 authored by Pierre Dittgen's avatar Pierre Dittgen

Add catalog descriptions on home page

parent b58cb4ed
...@@ -3,11 +3,31 @@ ...@@ -3,11 +3,31 @@
{ {
"name": "scdl", "name": "scdl",
"title": "Socle Commun des Données Locales", "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" "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", "name": "external",
"title": "Validateurs externes", "title": "Validateurs externes",
"description": "Sélection d'outils de validation de données complémentaires à Validata.",
"links": [ "links": [
{ {
"name": "inspire", "name": "inspire",
......
{% extends "base_template.html" %} {% 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 title %}Accueil{% endblock %}
{% block content %} {% block content %}
...@@ -8,6 +17,9 @@ ...@@ -8,6 +17,9 @@
{% if section.catalog %} {% if section.catalog %}
<div class="mb-5"> <div class="mb-5">
<h2 class="my-4">{{ section.title }}</h2> <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"> <form action="{{ url_for('custom_validator') }}" method="GET">
<div class="form-row"> <div class="form-row">
<div class="form-group col-lg-9"> <div class="form-group col-lg-9">
...@@ -28,7 +40,8 @@ ...@@ -28,7 +40,8 @@
{% endfor %} {% endfor %}
<div class="my-5"> <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"> <form action="{{ url_for('custom_validator') }}" data-cy="custom_schema_form" method="GET">
<div class="form-row"> <div class="form-row">
<div class="form-group col-lg-9"> <div class="form-group col-lg-9">
...@@ -57,6 +70,9 @@ ...@@ -57,6 +70,9 @@
{% if section.links %} {% if section.links %}
<div class="my-5"> <div class="my-5">
<h2 class="my-4">{{ section.title }}</h2> <h2 class="my-4">{{ section.title }}</h2>
{% if section.description %}
<p class="text-muted">{{ section.description}}</p>
{% endif %}
<div class="row my-4"> <div class="row my-4">
{% for item in section.links %} {% for item in section.links %}
<div class="col-sm-4 mb-4"> <div class="col-sm-4 mb-4">
...@@ -69,8 +85,7 @@ ...@@ -69,8 +85,7 @@
class="btn btn-outline-secondary mt-auto" class="btn btn-outline-secondary mt-auto"
>Utiliser >Utiliser
<i class="fas fa-external-link-alt ml-1"></i> <i class="fas fa-external-link-alt ml-1"></i>
</a </a>
>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -437,7 +437,7 @@ def home(): ...@@ -437,7 +437,7 @@ def home():
if not config.HOMEPAGE_CONFIG: if not config.HOMEPAGE_CONFIG:
return return
for section in config.HOMEPAGE_CONFIG['sections']: 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: if "catalog" in section:
schema_catalog = get_schema_catalog(section['name']) schema_catalog = get_schema_catalog(section['name'])
if schema_catalog: if schema_catalog:
...@@ -447,7 +447,7 @@ def home(): ...@@ -447,7 +447,7 @@ def home():
table_schema = tableschema_from_url(schema_reference.get_schema_url()) table_schema = tableschema_from_url(schema_reference.get_schema_url())
home_section_catalog.append({ home_section_catalog.append({
"name": schema_reference.name, "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 home_section['catalog'] = home_section_catalog
if "links" in section: 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