diff --git a/app/assets/images/faq/administrateur-procedure-test-usager.png b/app/assets/images/faq/administrateur-procedure-test-usager.png index 290a24709..ae7d76fe7 100644 Binary files a/app/assets/images/faq/administrateur-procedure-test-usager.png and b/app/assets/images/faq/administrateur-procedure-test-usager.png differ diff --git a/app/assets/images/faq/sign-in-page.png b/app/assets/images/faq/sign-in-page.png index c5500c9b8..f75d879e2 100644 Binary files a/app/assets/images/faq/sign-in-page.png and b/app/assets/images/faq/sign-in-page.png differ diff --git a/app/assets/images/faq/usager-confirm-update-email.png b/app/assets/images/faq/usager-confirm-update-email.png deleted file mode 100644 index b93ff5680..000000000 Binary files a/app/assets/images/faq/usager-confirm-update-email.png and /dev/null differ diff --git a/app/assets/images/faq/usager-dropdown.png b/app/assets/images/faq/usager-dropdown.png index 6fd5f65a2..3f501193b 100644 Binary files a/app/assets/images/faq/usager-dropdown.png and b/app/assets/images/faq/usager-dropdown.png differ diff --git a/app/controllers/faq_controller.rb b/app/controllers/faq_controller.rb index deafe5984..7f0009c30 100644 --- a/app/controllers/faq_controller.rb +++ b/app/controllers/faq_controller.rb @@ -21,7 +21,7 @@ class FAQController < ApplicationController application_base_url: Current.application_base_url, application_name: Current.application_name, contact_email: Current.contact_email - } + }.merge(dynamic_substitutions) FAQsLoaderService.new(substitutions) end @@ -36,4 +36,13 @@ class FAQController < ApplicationController rescue KeyError raise ActionController::RoutingError.new("FAQ not found: #{path}") end + + # Hash of dynamic values used for substitutions. + # The values are fetched from or calculated into the Rails cache. + def dynamic_substitutions + { + # Example: + # procedures_count: Rails.cache.fetch("faq/procedures_count", expires_in: 1.day) { helpers.number_with_delimiter(Procedure.publiee.count, delimiter: ' ') }, + } + end end diff --git a/app/lib/redcarpet/trusted_renderer.rb b/app/lib/redcarpet/trusted_renderer.rb index f0ee50129..850841135 100644 --- a/app/lib/redcarpet/trusted_renderer.rb +++ b/app/lib/redcarpet/trusted_renderer.rb @@ -37,5 +37,20 @@ module Redcarpet def image(link, title, alt) view_context.image_tag(link, title:, alt:, loading: :lazy) end + + # rubocop:disable Rails/OutputSafety + def block_quote(raw_html) + if raw_html =~ /^
\[!(INFO|WARNING)\]\n/ + state = Regexp.last_match(1).downcase.to_sym + content = raw_html.sub(/^
\[!(?:INFO|WARNING)\]\n/, '
')
+ component = Dsfr::AlertComponent.new(state:, heading_level: "h2", extra_class_names: "fr-my-3w")
+ component.render_in(view_context) do |c|
+ c.with_body { content.html_safe }
+ end
+ else
+ view_context.content_tag(:blockquote, raw_html.html_safe)
+ end
+ end
+ # rubocop:enable Rails/OutputSafety
end
end
diff --git a/app/services/faqs_loader_service.rb b/app/services/faqs_loader_service.rb
index 563a05775..be2434d83 100644
--- a/app/services/faqs_loader_service.rb
+++ b/app/services/faqs_loader_service.rb
@@ -9,13 +9,13 @@ class FAQsLoaderService
def initialize(substitutions)
@substitutions = substitutions
- @faqs_by_path ||= Rails.cache.fetch(["faqs_data", ApplicationVersion.current, substitutions], expires_in: 1.week) do
+ @faqs_by_path ||= Rails.cache.fetch(["faqs_data", ApplicationVersion.current, substitutions], expires_in: 1.day) do
load_faqs
end
end
def find(path)
- Rails.cache.fetch(["faq", path, ApplicationVersion.current, substitutions], expires_in: 1.week) do
+ Rails.cache.fetch(["faq", path, ApplicationVersion.current, substitutions], expires_in: 1.day) do
file_path = @faqs_by_path.fetch(path).fetch(:file_path)
parse_with_substitutions(file_path)
diff --git a/doc/faqs/usager/comment-trouver-ma-demarche.fr.md b/doc/faqs/usager/01_comment-trouver-ma-demarche.fr.md
similarity index 85%
rename from doc/faqs/usager/comment-trouver-ma-demarche.fr.md
rename to doc/faqs/usager/01_comment-trouver-ma-demarche.fr.md
index 49fff79ae..6a7cafb29 100644
--- a/doc/faqs/usager/comment-trouver-ma-demarche.fr.md
+++ b/doc/faqs/usager/01_comment-trouver-ma-demarche.fr.md
@@ -9,6 +9,16 @@ title: "Comment trouver ma démarche ?"
# Comment trouver ma démarche ?
+> [!INFO]
+> *%{application_name}* est un service de la direction interministérielle du numérique, service du Premier ministre.
+
+> Ce site ne dispose pas d’un annuaire comprenant l’ensemble des démarches administratives en ligne. Vous pouvez retrouver des informations soit :
+
+> - sur le site [service-public.fr](https://www.service-public.fr) : site officiel d'information sur les démarches administratives
+> - sur le site internet de l’administration concernée (ministère, organisme, préfecture, mairie…)
+
+> Pour effectuer un dépôt sur %{application_name} vous devez notamment disposer d’un lien qui vous a été communiqué par l’administration.
+
## 1. Trouver le lien de votre démarche
Pour déposer un dossier sur %{application_name}, il est nécessaire de disposer du lien de la démarche qui vous intéresse. Il ressemble à un lien de cette forme :
@@ -55,5 +65,3 @@ Pour commencer un nouveau dossier sur une démarche déjà réalisée, [connecte
Pour connaitre le nouveau lien vers la démarche en ligne, nous vous invitons à contacter le service en charge de la démarche. Vous trouverez les informations de contact en bas du formulaire dans la partie **« Poser une questions sur la démarche »** (en cliquant sur le numéro de dossier).

-
-
diff --git a/doc/faqs/usager/je-veux-changer-mon-adresse-email.fr.md b/doc/faqs/usager/je-veux-changer-mon-adresse-email.fr.md
index ba4e68ed3..2cb8b8dab 100644
--- a/doc/faqs/usager/je-veux-changer-mon-adresse-email.fr.md
+++ b/doc/faqs/usager/je-veux-changer-mon-adresse-email.fr.md
@@ -27,8 +27,7 @@ Pour changer l’adresse email associée à votre compte, suivez les étapes sui
3. Dans l’encadré _« Coordonnées »_, renseignez la nouvelle adresse email que vous souhaitez utiliser. Puis cliquez sur _« Changer mon adresse »_. **Attention** : Cette adresse ne doit pas être déjà utilisée par un autre compte sur %{application_name}.

-4. Ouvrez la boîte email de votre nouvelle adresse, et cliquez sur le lien de confirmation que nous vous avons envoyé.
- 
+4. Ouvrez la boîte email de votre nouvelle adresse, et cliquez sur le lien de confirmation que nous vous avons envoyé.
## Si l’adresse est déjà utilisée par un autre compte
diff --git a/spec/lib/redcarpet/trusted_renderer_spec.rb b/spec/lib/redcarpet/trusted_renderer_spec.rb
index 046472026..b0be7a94a 100644
--- a/spec/lib/redcarpet/trusted_renderer_spec.rb
+++ b/spec/lib/redcarpet/trusted_renderer_spec.rb
@@ -32,4 +32,28 @@ RSpec.describe Redcarpet::TrustedRenderer do
expect(renderer.render(markdown)).to include('user@example.com')
end
end
+
+ context 'with block_quote DSFR alert' do
+ it 'renders [!INFO] blocks as DSFR info alerts' do
+ markdown = "> [!INFO]\n> This is an information alert with *emphasis*."
+ expected_html = <<~HTML
+
This is an information alert with emphasis.
+This is a warning alert.
+