chore(flipper): add feature_enabled? to components

This commit is contained in:
Paul Chavard 2022-10-12 11:48:24 +02:00
parent 03c714e86d
commit 0f192fd752
2 changed files with 6 additions and 1 deletions

View file

@ -1,7 +1,12 @@
class ApplicationComponent < ViewComponent::Base class ApplicationComponent < ViewComponent::Base
include ViewComponent::Translatable include ViewComponent::Translatable
include FlipperHelper
def class_names(class_names) def class_names(class_names)
class_names.to_a.filter_map { |(class_name, flag)| class_name if flag }.join(' ') class_names.to_a.filter_map { |(class_name, flag)| class_name if flag }.join(' ')
end end
def current_user
controller.current_user
end
end end

View file

@ -6,6 +6,6 @@
%span.updated-at{ class: highlight_if_unseen_class } %span.updated-at{ class: highlight_if_unseen_class }
= "modifié le #{try_format_datetime(@champ.updated_at)}" = "modifié le #{try_format_datetime(@champ.updated_at)}"
- if @champ.rebased_at.present? && @champ.rebased_at > (@seen_at || @champ.updated_at) && controller.current_user.owns_or_invite?(@champ.dossier) - if @champ.rebased_at.present? && @champ.rebased_at > (@seen_at || @champ.updated_at) && current_user.owns_or_invite?(@champ.dossier)
%span.updated-at.highlighted %span.updated-at.highlighted
Le type de ce @champ où sa description a été modifiée par l'administration. Vérifier son contenu. Le type de ce @champ où sa description a été modifiée par l'administration. Vérifier son contenu.