feature: type_de_champ_controller

This commit is contained in:
simon lehericey 2022-07-11 21:18:08 +02:00
parent 2da0aa6525
commit 2fee0ddfd4
9 changed files with 181 additions and 47 deletions

View file

@ -1,14 +1,19 @@
- sibling = coordinate.previous_sibling
- if @destroyed.present?
= turbo_stream.remove dom_id(@destroyed, :type_de_champ_editor)
- if @created.present?
- if @created.coordinate.previous_sibling.present?
= turbo_stream.after dom_id(@created.coordinate.previous_sibling, :type_de_champ_editor) do
= render @created
- else
= turbo_stream.prepend dom_id(@created.coordinate.block, :types_de_champ_editor_block) do
= render @created
- @morphed&.each do |champ_component|
= turbo_stream.morph dom_id(champ_component.coordinate, :type_de_champ_editor) do
= render champ_component
= turbo_stream.morph dom_id(@coordinate.revision, :estimated_fill_duration) do
= render TypesDeChampEditor::EstimatedFillDurationComponent.new(revision: @coordinate.revision, is_annotation: @coordinate.private?)
- if sibling.present?
= turbo_stream.after dom_id(sibling, :type_de_champ_editor) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: coordinate, upper_coordinates: upper_coordinates, focused: true)
- else
= turbo_stream.prepend dom_id(coordinate.block, :types_de_champ_editor_block) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: coordinate, upper_coordinates: upper_coordinates, focused: true)
= turbo_stream.dispatch 'sortable:sort'
- if @lower_coordinates_and_dep.present?
- @lower_coordinates_and_dep.each do |other_coordinate, other_upper_coordinates|
= turbo_stream.morph dom_id(other_coordinate, :type_de_champ_editor) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: other_coordinate, upper_coordinates: other_upper_coordinates)

View file

@ -1,2 +1 @@
- if @coordinate&.type_de_champ&.valid?
= render partial: 'insert', locals: { coordinate: @coordinate, upper_coordinates: @upper_coordinates }
= render partial: 'insert'

View file

@ -1,9 +1 @@
= turbo_stream.remove dom_id(@coordinate, :type_de_champ_editor)
= turbo_stream.dispatch 'sortable:sort'
= turbo_stream.morph dom_id(@coordinate.revision, :estimated_fill_duration) do
= render TypesDeChampEditor::EstimatedFillDurationComponent.new(revision: @coordinate.revision, is_annotation: @coordinate.private?)
- if @lower_coordinates_and_dep.present?
- @lower_coordinates_and_dep.each do |other_coordinate, other_upper_coordinates|
= turbo_stream.morph dom_id(other_coordinate, :type_de_champ_editor) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: other_coordinate, upper_coordinates: other_upper_coordinates)
= render partial: 'insert'

View file

@ -1,2 +1 @@
= turbo_stream.remove dom_id(@coordinate, :type_de_champ_editor)
= render partial: 'insert', locals: { coordinate: @coordinate, upper_coordinates: @upper_coordinates }
= render partial: 'insert'

View file

@ -1,2 +1 @@
= turbo_stream.remove dom_id(@coordinate, :type_de_champ_editor)
= render partial: 'insert', locals: { coordinate: @coordinate, upper_coordinates: @upper_coordinates }
= render partial: 'insert'

View file

@ -1,10 +1 @@
- if @coordinate&.type_de_champ&.valid?
= turbo_stream.morph dom_id(@coordinate, :type_de_champ_editor) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: @coordinate, upper_coordinates: @upper_coordinates)
= turbo_stream.morph dom_id(@coordinate.revision, :estimated_fill_duration) do
= render TypesDeChampEditor::EstimatedFillDurationComponent.new(revision: @coordinate.revision, is_annotation: @coordinate.private?)
- if @lower_coordinates_and_dep.present?
- @lower_coordinates_and_dep.each do |other_coordinate, other_upper_coordinates|
= turbo_stream.morph dom_id(other_coordinate, :type_de_champ_editor) do
= render TypesDeChampEditor::ChampComponent.new(coordinate: other_coordinate, upper_coordinates: other_upper_coordinates)
= render partial: 'insert'