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

23 lines
492 B
Ruby
Raw Normal View History

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