diff --git a/app/components/types_de_champ_editor/editor_component/editor_component.html.haml b/app/components/types_de_champ_editor/editor_component/editor_component.html.haml index 24db548e2..c35d11113 100644 --- a/app/components/types_de_champ_editor/editor_component/editor_component.html.haml +++ b/app/components/types_de_champ_editor/editor_component/editor_component.html.haml @@ -1,6 +1,7 @@ -.fr-container.fr-pb-12w - .types-de-champ-editor.editor-root{ 'data-turbo': 'true', id: dom_id(@revision, :types_de_champ_editor) } +.fr-container.fr-pb-12w{ 'data-turbo': 'true', id: dom_id(@revision, :types_de_champ_editor) } + .types-de-champ-editor.editor-root = render TypesDeChampEditor::ErrorsSummary.new(revision: @revision) = render TypesDeChampEditor::BlockComponent.new(block: @revision, coordinates: coordinates) - if coordinates.empty? - = render TypesDeChampEditor::AddChampButtonComponent.new(revision: @revision, is_annotation: annotations?) + #empty-coordinates + = render TypesDeChampEditor::AddChampButtonComponent.new(revision: @revision, is_annotation: annotations?) diff --git a/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml b/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml index fee164d69..758d5482a 100644 --- a/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml +++ b/app/views/administrateurs/types_de_champ/_insert.turbo_stream.haml @@ -9,6 +9,9 @@ - if @destroyed.present? = turbo_stream.remove dom_id(@destroyed, :type_de_champ_editor) + - if @destroyed.siblings.empty? + = turbo_stream.show('empty-coordinates') + - if @created.present? - if @created.coordinate.previous_sibling.present? = turbo_stream.after dom_id(@created.coordinate.previous_sibling, :type_de_champ_editor) do @@ -17,6 +20,8 @@ = turbo_stream.prepend dom_id(@created.coordinate.block, :types_de_champ_editor_block) do - render @created + = turbo_stream.hide('empty-coordinates') + - @morphed&.each do |champ_component| = turbo_stream.replace dom_id(champ_component.coordinate, :type_de_champ_editor) do - render champ_component