2023-03-24 11:08:31 +01:00
|
|
|
class EditableChamp::HeaderSectionComponent < ApplicationComponent
|
2023-04-14 10:55:36 +02:00
|
|
|
def initialize(form: nil, champ:, seen_at: nil)
|
2023-03-24 11:08:31 +01:00
|
|
|
@champ = champ
|
2023-04-12 17:55:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def level
|
|
|
|
@champ.level
|
2023-03-24 11:08:31 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def libelle
|
|
|
|
@champ.libelle
|
|
|
|
end
|
|
|
|
|
|
|
|
def header_section_classnames
|
2023-04-24 10:38:17 +02:00
|
|
|
class_names(
|
|
|
|
"fr-h#{level}": true,
|
|
|
|
'header-section': @champ.dossier.auto_numbering_section_headers_for?(@champ),
|
|
|
|
'hidden': !@champ.visible?
|
|
|
|
)
|
2023-03-24 11:08:31 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def tag_for_depth
|
2023-04-12 17:55:08 +02:00
|
|
|
"h#{level + 1}"
|
2023-03-24 11:08:31 +01:00
|
|
|
end
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|