Small fix link to prefill type de champ

This commit is contained in:
Damien Le Thiec 2023-01-31 16:24:32 +01:00
parent 20ba96ba3c
commit f91cc05d95
4 changed files with 2 additions and 6 deletions

View file

@ -2,7 +2,6 @@ class API::Public::V1::DossiersController < API::Public::V1::BaseController
before_action :retrieve_procedure
def create
byebug
dossier = Dossier.new(
revision: @procedure.active_revision,
groupe_instructeur: @procedure.defaut_groupe_instructeur_for_new_dossier,

View file

@ -12,6 +12,6 @@ class PrefillTypeDeChampsController < ApplicationController
end
def set_prefill_type_de_champ
@type_de_champ = TypesDeChamp::PrefillTypeDeChamp.build(@procedure.active_revision.types_de_champ_public.fillable.find(params[:id]))
@type_de_champ = TypesDeChamp::PrefillTypeDeChamp.build(@procedure.active_revision.types_de_champ.fillable.find(params[:id]))
end
end

View file

@ -11,9 +11,6 @@ class PrefillParams
private
def build_prefill_values
byebug
# nop : "[{\"txt\":\"Texte court\", \"nb\":\"3.14\", \"Test dropdown\":\"Premier choix\", \"régio\":\"53\"}, {\"txt\":\"Texte court\", \"nb\":\"3.14\", \"Test dropdown\":\"Premier choix\", \"régio\":\"53\"}]"
# {"champ_Q2hhbXAtNDI="=>["{\"txt\":\"abc\", \"nb\":\"1,12\"}", "{\"txt\":\"def\", \"nb\":\"2,12\"}"]}
value_by_stable_id = @params
.map { |prefixed_typed_id, value| [stable_id_from_typed_id(prefixed_typed_id), value] }
.filter { |stable_id, value| stable_id.present? && value.present? }

View file

@ -4,7 +4,7 @@ class TypesDeChamp::PrefillRepetitionTypeDeChamp < TypesDeChamp::PrefillTypeDeCh
def possible_values
prefillable_subchamps.map do |prefill_type_de_champ|
if prefill_type_de_champ.too_many_possible_values?
link = link_to "Voir toutes les valeurs possibles", Rails.application.routes.url_helpers.prefill_type_de_champ_path("piece-jointe", self)
link = link_to "Voir toutes les valeurs possibles", Rails.application.routes.url_helpers.prefill_type_de_champ_path("piece-jointe", prefill_type_de_champ)
"#{prefill_type_de_champ.libelle}: #{link}"
else
"#{prefill_type_de_champ.libelle}: #{prefill_type_de_champ.possible_values_sentence}"