dossier: ensure the routing dropdown must be selected
A blank routing dropdown nullify the groupe_instructeur – which also removes the link between the dossier and the procedure. Fix #4717
This commit is contained in:
parent
0f88409f4a
commit
eb9388d59f
1 changed files with 14 additions and 3 deletions
|
@ -30,11 +30,22 @@
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
- if dossier.procedure.routee?
|
- if dossier.procedure.routee?
|
||||||
= f.label :groupe_instructeur_id, dossier.procedure.routing_criteria_name
|
= f.label :groupe_instructeur_id do
|
||||||
|
= dossier.procedure.routing_criteria_name
|
||||||
|
%span.mandatory *
|
||||||
|
-# The routing dropdown has 'include_blank: false', because otherwise a blank
|
||||||
|
-# value may nullify the groupe_instructeur – and thus the link between the dossier
|
||||||
|
-# and its procedure.
|
||||||
|
-#
|
||||||
|
-# If, one day, we need to make clearer to the user that they must actually choose an
|
||||||
|
-# option, THINK TWICE before adding a blank option, and what would happen if the form is
|
||||||
|
-# saved when the blank option is selected.
|
||||||
|
-# Instead please consider other possibilities; like using CSS to gray out the default option,
|
||||||
|
-# or adding some "(please select an option)" wording aside the label of the default group.
|
||||||
|
-# CSS
|
||||||
= f.select :groupe_instructeur_id,
|
= f.select :groupe_instructeur_id,
|
||||||
dossier.procedure.groupe_instructeurs.order(:label).map { |gi| [gi.label, gi.id] },
|
dossier.procedure.groupe_instructeurs.order(:label).map { |gi| [gi.label, gi.id] },
|
||||||
{},
|
{ include_blank: false }
|
||||||
required: true
|
|
||||||
|
|
||||||
= f.fields_for :champs, dossier.champs do |champ_form|
|
= f.fields_for :champs, dossier.champs do |champ_form|
|
||||||
- champ = champ_form.object
|
- champ = champ_form.object
|
||||||
|
|
Loading…
Reference in a new issue