2023-10-04 14:57:32 +02:00
|
|
|
module ReleaseNotesHelper
|
|
|
|
def announce_category_badge(category)
|
|
|
|
color_class = case category.to_sym
|
|
|
|
when :administrateur
|
|
|
|
'fr-background-flat--blue-france fr-text-inverted--blue-france'
|
|
|
|
when :instructeur
|
|
|
|
'fr-background-contrast--yellow-tournesol'
|
|
|
|
when :expert
|
|
|
|
'fr-background-contrast--purple-glycine'
|
|
|
|
when :usager
|
|
|
|
'fr-background-contrast--green-emeraude'
|
|
|
|
when :api
|
|
|
|
'fr-background-contrast--blue-ecume'
|
|
|
|
end
|
|
|
|
|
|
|
|
content_tag(:span, ReleaseNote.human_attribute_name("categories.#{category}"), class: "fr-badge #{color_class}")
|
|
|
|
end
|
2023-10-31 10:50:28 +01:00
|
|
|
|
|
|
|
def infer_default_announce_categories
|
|
|
|
if administrateur_signed_in?
|
|
|
|
ReleaseNote.default_categories_for_role(:administrateur, current_administrateur)
|
|
|
|
elsif instructeur_signed_in?
|
|
|
|
ReleaseNote.default_categories_for_role(:instructeur, current_instructeur)
|
|
|
|
elsif expert_signed_in?
|
|
|
|
ReleaseNote.default_categories_for_role(:expert, current_expert)
|
|
|
|
else
|
|
|
|
ReleaseNote.default_categories_for_role(:usager)
|
|
|
|
end
|
|
|
|
end
|
2023-10-04 14:57:32 +02:00
|
|
|
end
|