[#2486] Always order champs

to help activerecord cache the champs collection
This commit is contained in:
Frederic Merizen 2018-08-30 11:51:35 +02:00
parent 0e2b7ec6e1
commit 37c45f0d29
7 changed files with 19 additions and 27 deletions

View file

@ -3,10 +3,10 @@
= render partial: "header", locals: { dossier: @dossier }
#dossier-annotations-privees.container
- if @dossier.ordered_champs_private.present?
- if @dossier.champs_private.present?
%section
= form_for @dossier, url: annotations_gestionnaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
= f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form|
= f.fields_for :champs_private, f.object.champs_private do |champ_form|
- champ = champ_form.object
= render partial: "shared/dossiers/editable_champs/editable_champ",
locals: { champ: champ, form: champ_form, seen_at: @annotations_privees_seen_at }

View file

@ -13,7 +13,7 @@
%h2 Formulaire
- champs = @dossier.ordered_champs.decorate
- champs = @dossier.champs.decorate
- if champs.any?
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: nil }
@ -49,7 +49,7 @@
%h2 Annotations privées
- if @dossier.ordered_champs_private.present?
- if @dossier.champs_private.present?
%table
- @dossier.champs_private.each do |champ|
%tr