demarches-normaliennes/app/components/editable_champ/header_section_component.rb

26 lines
476 B
Ruby
Raw Normal View History

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