2022-04-25 12:40:16 +02:00
|
|
|
class ApplicationComponent < ViewComponent::Base
|
|
|
|
include ViewComponent::Translatable
|
2022-10-12 11:48:24 +02:00
|
|
|
include FlipperHelper
|
2022-06-16 14:56:53 +02:00
|
|
|
|
2022-11-09 12:33:20 +01:00
|
|
|
# Takes a Hash of { class_name: boolean }.
|
|
|
|
# Returns truthy class names in an array. Array can be passed as-it in rails helpers,
|
|
|
|
# and is still manipulable if needed.
|
2022-06-16 14:56:53 +02:00
|
|
|
def class_names(class_names)
|
2022-11-09 12:33:20 +01:00
|
|
|
class_names.filter { _2 }.keys
|
2022-06-16 14:56:53 +02:00
|
|
|
end
|
2022-10-12 11:48:24 +02:00
|
|
|
|
|
|
|
def current_user
|
|
|
|
controller.current_user
|
|
|
|
end
|
2022-11-21 12:22:41 +01:00
|
|
|
|
|
|
|
def current_administrateur
|
|
|
|
controller.current_administrateur
|
|
|
|
end
|
2022-04-25 12:40:16 +02:00
|
|
|
end
|