refactor(champs): change views to use new urls with stable_id and row_id

This commit is contained in:
Paul Chavard 2024-04-22 10:47:47 +02:00
parent 6e71a20257
commit bcd3f3b471
21 changed files with 104 additions and 36 deletions

View file

@ -3,6 +3,7 @@ class Champs::OptionsController < Champs::ChampController
def remove
@champ.remove_option([params[:option]].compact, true)
@champ.reload
@dossier = @champ.private? ? nil : @champ.dossier
champs_attributes = { @champ.public_id => params[:champ_id].present? ? { id: @champ.id } : { with_public_id: true } }
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes, @champ.dossier.champs)

View file

@ -295,11 +295,12 @@ module Instructeurs
def annotation
@dossier = dossier_with_champs(pj_template: false)
annotation_id_or_stable_id = params[:stable_id]
annotation = if params[:with_public_id].present?
type_de_champ = @dossier.find_type_de_champ_by_stable_id(params[:annotation_id], :private)
type_de_champ = @dossier.find_type_de_champ_by_stable_id(annotation_id_or_stable_id, :private)
@dossier.project_champ(type_de_champ, params[:row_id])
else
@dossier.champs_private_all.find(params[:annotation_id])
@dossier.champs_private_all.find(annotation_id_or_stable_id)
end
respond_to do |format|

View file

@ -317,11 +317,12 @@ module Users
def champ
@dossier = dossier_with_champs(pj_template: false)
champ_id_or_stable_id = params[:stable_id]
champ = if params[:with_public_id].present?
type_de_champ = @dossier.find_type_de_champ_by_stable_id(params[:champ_id], :public)
type_de_champ = @dossier.find_type_de_champ_by_stable_id(champ_id_or_stable_id, :public)
@dossier.project_champ(type_de_champ, params[:row_id])
else
@dossier.champs_public_all.find(params[:champ_id])
@dossier.champs_public_all.find(champ_id_or_stable_id)
end
respond_to do |format|