Skip to content

Commit

Permalink
Datasets: label experimental
Browse files Browse the repository at this point in the history
Fixes #4275.
  • Loading branch information
ptitfred committed Oct 29, 2024
1 parent 6ec1731 commit ed3becc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ defmodule TransportWeb.CustomTagsLive do
%{
name: "authentification_requise",
doc: "Indique sur la page du JDD qu'il est nécessaire de s'authentifier pour accéder aux données."
},
%{
name: "experimental",
doc: "Ajoute sur la page du JDD une bannière indiquant que le jeu est expérimental"
}
]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
"The producer requires authentication to access the data. Consequently, some features on transport.data.gouv.fr, such as data availability, validations, and metadata, are unavailable for this dataset. Please follow the producer's instructions to gain access to the data."
) %>
</p>
<p :if={experimental?(@dataset)} class="notification mt-0">
ℹ️ <%= dgettext(
"page-dataset-details",
"This unofficial dataset is provided experimentally. Do not use it for travel information purpose."
) %>
</p>
8 changes: 8 additions & 0 deletions apps/transport/lib/transport_web/views/dataset_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,14 @@ defmodule TransportWeb.DatasetView do
"""
def seasonal_warning?(%DB.Dataset{} = dataset), do: DB.Dataset.has_custom_tag?(dataset, "saisonnier")

@doc """
iex> experimental?(%DB.Dataset{custom_tags: ["experimental", "foo"]})
true
iex> experimental?(%DB.Dataset{custom_tags: ["foo"]})
false
"""
def experimental?(%DB.Dataset{} = dataset), do: DB.Dataset.has_custom_tag?(dataset, "experimental")

def authentication_required?(%DB.Dataset{} = dataset),
do: DB.Dataset.has_custom_tag?(dataset, "authentification_requise")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,7 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Data under the responsibility of"
msgstr ""

#, elixir-autogen, elixir-format
msgid "This unofficial dataset is provided experimentally. Do not use it for travel information purpose."
msgstr ""
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,7 @@ msgstr "Le producteur requiert une authentification pour accéder aux données.
#, elixir-autogen, elixir-format
msgid "Data under the responsibility of"
msgstr "Données sous la responsabilité de"

#, elixir-autogen, elixir-format
msgid "This unofficial dataset is provided experimentally. Do not use it for travel information purpose."
msgstr "Ce jeu de données non officiel est publié à titre expérimental. Veuillez à ne pas le réutiliser à des fins d'information voyageur."
4 changes: 4 additions & 0 deletions apps/transport/priv/gettext/page-dataset-details.pot
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,7 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Data under the responsibility of"
msgstr ""

#, elixir-autogen, elixir-format
msgid "This unofficial dataset is provided experimentally. Do not use it for travel information purpose."
msgstr ""

0 comments on commit ed3becc

Please sign in to comment.