Merge pull request #9556 from demarches-simplifiees/fix_conditionnal
Administrateur : correction de l'affichage du bouton "logique conditionnelle" dans l'éditeur de champ
This commit is contained in:
commit
e3b05f7e20
4 changed files with 37 additions and 10 deletions
|
@ -56,13 +56,7 @@ module Administrateurs
|
|||
def retrieve_coordinate_and_uppers
|
||||
@tdc = draft_revision.find_and_ensure_exclusive_use(params[:stable_id])
|
||||
@coordinate = draft_revision.coordinate_for(@tdc)
|
||||
|
||||
upper_coordinates = @coordinate.upper_siblings
|
||||
if @coordinate.child?
|
||||
upper_coordinates += @coordinate.parent.upper_siblings
|
||||
end
|
||||
|
||||
@upper_tdcs = upper_coordinates.map(&:type_de_champ)
|
||||
@upper_tdcs = @coordinate.upper_coordinates.map(&:type_de_champ)
|
||||
end
|
||||
|
||||
def draft_revision
|
||||
|
|
|
@ -105,7 +105,7 @@ module Administrateurs
|
|||
def champ_component_from(coordinate, focused: false, errors: '')
|
||||
TypesDeChampEditor::ChampComponent.new(
|
||||
coordinate:,
|
||||
upper_coordinates: coordinate.upper_siblings,
|
||||
upper_coordinates: coordinate.upper_coordinates,
|
||||
focused: focused,
|
||||
errors:
|
||||
)
|
||||
|
|
|
@ -39,8 +39,14 @@ class ProcedureRevisionTypeDeChamp < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def upper_siblings
|
||||
siblings.filter { |s| s.position < position }
|
||||
def upper_coordinates
|
||||
upper = siblings.filter { |s| s.position < position }
|
||||
|
||||
if child?
|
||||
upper += parent.upper_coordinates
|
||||
end
|
||||
|
||||
upper
|
||||
end
|
||||
|
||||
def siblings_starting_at(offset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue