e64ac79f05
root -> rooted_tree depth_cach -> walk smal refactor comment remove form for header_section remove seen_at from header section header_section: champ -> header_section champ_subree: remove if not remove root_depth use header_section_level_value instead remove unused include remove ChampTreeComponent rename ChampsSubtreeComponent to SectionComponent use TreeableConcern only in section component remove fields_for_champ_component champs -> tail add split_section_champ helper refactor(editable_champ::header_section): keep same interface everywhere fix(repetition): add spec for SectionComponent on repetitions
24 lines
458 B
Ruby
24 lines
458 B
Ruby
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}"]
|
|
|
|
class_names << 'header-section' if @champ.dossier.auto_numbering_section_headers_for?(@champ)
|
|
class_names
|
|
end
|
|
|
|
def tag_for_depth
|
|
"h#{level + 1}"
|
|
end
|
|
end
|