feat(faq): dynamic substitutions support

Ce code avait été initalement codé, mais le contenu de la FAQ n'en a à
ce stade plus besoin. On le garde sous le coude car c'est peu touchy
et ça pourrait bientôt resservir.
This commit is contained in:
Colin Darie 2024-05-17 15:53:59 +02:00
parent e9920c76d5
commit 417cac5b83
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
3 changed files with 25 additions and 3 deletions

View file

@ -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