fix(dossier): removing options from multiselect should update conditions

This commit is contained in:
Paul Chavard 2023-08-03 11:06:40 +02:00
parent 98909f922b
commit b5f721912f
5 changed files with 24 additions and 27 deletions

View file

@ -1,8 +1,12 @@
class Champs::OptionsController < ApplicationController
include TurboChampsConcern
before_action :authenticate_logged_user!
def remove
@champ = policy_scope(Champ).includes(:champs).find(params[:champ_id])
@champ.remove_option([params[:option]].compact)
champ = policy_scope(Champ).includes(:champs).find(params[:champ_id])
champ.remove_option([params[:option]].compact)
champs = champ.private? ? champ.dossier.champs_private_all : champ.dossier.champs_public_all
@to_show, @to_hide, @to_update = champs_to_turbo_update({ params[:champ_id] => true }, champs)
end
end