refactor(dossier): remove old section code
This commit is contained in:
parent
02591da16b
commit
f7758d0033
3 changed files with 4 additions and 12 deletions
|
@ -99,10 +99,6 @@ class Champ < ApplicationRecord
|
|||
[row_id, stable_id].compact
|
||||
end
|
||||
|
||||
def sections
|
||||
@sections ||= dossier.sections_for(self)
|
||||
end
|
||||
|
||||
# used for the `required` html attribute
|
||||
# check visibility to avoid hidden required input
|
||||
# which prevent the form from being sent.
|
||||
|
|
|
@ -16,8 +16,4 @@ class Champs::HeaderSectionChamp < Champ
|
|||
def libelle_with_section_index?
|
||||
libelle =~ /^\d/
|
||||
end
|
||||
|
||||
def section_index
|
||||
sections.index(self) + 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,11 @@ module DossierSectionsConcern
|
|||
@sections = Hash.new do |hash, parent|
|
||||
case parent
|
||||
when :public
|
||||
hash[parent] = champs_public.filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(:public, true).filter(&:header_section?)
|
||||
when :private
|
||||
hash[parent] = champs_private.filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(:private, true).filter(&:header_section?)
|
||||
else
|
||||
hash[parent] = parent.champs.filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(parent.type_de_champ).filter(&:header_section?)
|
||||
end
|
||||
end
|
||||
@sections[champ.parent || (champ.public? ? :public : :private)]
|
||||
|
@ -23,7 +23,7 @@ module DossierSectionsConcern
|
|||
end
|
||||
|
||||
def index_for_section_header(champ)
|
||||
champs = champ.private? ? champs_private : champs_public
|
||||
champs = champ.private? ? champs_for_revision(:private, true) : champs_for_revision(:public, true)
|
||||
index = 1
|
||||
champs.each do |c|
|
||||
if c.repetition?
|
||||
|
|
Loading…
Reference in a new issue