User can choose its gi
This commit is contained in:
parent
6b8cefa551
commit
b7434c3132
2 changed files with 12 additions and 4 deletions
|
@ -282,13 +282,14 @@ module Users
|
|||
end
|
||||
|
||||
# FIXME: require(:dossier) when all the champs are united
|
||||
def champs_params
|
||||
params.permit(dossier: {
|
||||
def champs_and_groupe_instructeurs_params
|
||||
params.permit(dossier: [
|
||||
:groupe_instructeur_id,
|
||||
champs_attributes: [
|
||||
:id, :value, :primary_value, :secondary_value, :piece_justificative_file, value: [],
|
||||
champs_attributes: [:id, :_destroy, :value, :primary_value, :secondary_value, :piece_justificative_file, value: []]
|
||||
]
|
||||
})
|
||||
])
|
||||
end
|
||||
|
||||
def dossier
|
||||
|
@ -302,7 +303,7 @@ module Users
|
|||
def update_dossier_and_compute_errors
|
||||
errors = []
|
||||
|
||||
if champs_params[:dossier] && !@dossier.update(champs_params[:dossier])
|
||||
if champs_and_groupe_instructeurs_params[:dossier] && !@dossier.update(champs_and_groupe_instructeurs_params[:dossier])
|
||||
errors += @dossier.errors.full_messages
|
||||
end
|
||||
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
|
||||
%hr
|
||||
|
||||
- if dossier.procedure.routee?
|
||||
= f.label :groupe_instructeur_id, dossier.procedure.routing_criteria_name
|
||||
= f.select :groupe_instructeur_id,
|
||||
dossier.procedure.groupe_instructeurs.order(:label).map { |gi| [gi.label, gi.id] },
|
||||
{},
|
||||
required: true
|
||||
|
||||
= f.fields_for :champs, dossier.champs do |champ_form|
|
||||
- champ = champ_form.object
|
||||
= render partial: "shared/dossiers/editable_champs/editable_champ",
|
||||
|
|
Loading…
Reference in a new issue