From eac0e22c54b2f9ed4f95dcb45d5907da81b4ca79 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 6 Jun 2023 11:28:10 +0200 Subject: [PATCH] fix(carto): include champ carto modifications in fork diff and show submit button --- app/controllers/champs/carte_controller.rb | 6 +++++- app/views/champs/carte/index.turbo_stream.haml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/champs/carte_controller.rb b/app/controllers/champs/carte_controller.rb index 0bc927f5a..dee8e5853 100644 --- a/app/controllers/champs/carte_controller.rb +++ b/app/controllers/champs/carte_controller.rb @@ -39,6 +39,7 @@ class Champs::CarteController < ApplicationController def destroy champ = policy_scope(Champ).find(params[:champ_id]) champ.geo_areas.find(params[:id]).destroy! + champ.touch head :no_content end @@ -80,6 +81,9 @@ class Champs::CarteController < ApplicationController if feature[:properties] geo_area.properties.merge!(feature[:properties]) end - geo_area.save + if geo_area.save + geo_area.champ.touch + true + end end end diff --git a/app/views/champs/carte/index.turbo_stream.haml b/app/views/champs/carte/index.turbo_stream.haml index e5e4080a4..ebbdd946f 100644 --- a/app/views/champs/carte/index.turbo_stream.haml +++ b/app/views/champs/carte/index.turbo_stream.haml @@ -2,3 +2,7 @@ - if @focus = turbo_stream.dispatch 'map:feature:focus', bbox: @champ.bounding_box + +- if @champ.dossier.editing_fork? + = turbo_stream.replace_all '.dossier-edit-sticky-footer' do + = render Dossiers::EditFooterComponent.new(dossier: @champ.dossier, annotation: @champ.private?)