2023-03-29 23:31:13 +02:00
|
|
|
class Champs::OptionsController < ApplicationController
|
2023-08-03 11:06:40 +02:00
|
|
|
include TurboChampsConcern
|
|
|
|
|
2023-03-29 23:31:13 +02:00
|
|
|
before_action :authenticate_logged_user!
|
|
|
|
|
|
|
|
def remove
|
2023-08-03 11:06:40 +02:00
|
|
|
champ = policy_scope(Champ).includes(:champs).find(params[:champ_id])
|
2023-08-31 12:22:53 +02:00
|
|
|
champ.remove_option([params[:option]].compact, true)
|
2023-08-03 11:06:40 +02:00
|
|
|
champs = champ.private? ? champ.dossier.champs_private_all : champ.dossier.champs_public_all
|
2023-08-31 12:22:53 +02:00
|
|
|
@dossier = champ.private? ? nil : champ.dossier
|
2023-08-03 11:06:40 +02:00
|
|
|
@to_show, @to_hide, @to_update = champs_to_turbo_update({ params[:champ_id] => true }, champs)
|
2023-03-29 23:31:13 +02:00
|
|
|
end
|
|
|
|
end
|