NewDesign: can add annotations
This commit is contained in:
parent
b94fc7c132
commit
3e5d0dce6a
5 changed files with 71 additions and 0 deletions
|
@ -66,6 +66,12 @@ module NewGestionnaire
|
|||
redirect_to instruction_dossier_path(dossier.procedure, dossier)
|
||||
end
|
||||
|
||||
def update_annotations
|
||||
dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id])
|
||||
dossier.update_attributes(champs_private_params)
|
||||
redirect_to instruction_dossier_path(dossier.procedure, dossier)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def dossier
|
||||
|
@ -79,5 +85,9 @@ module NewGestionnaire
|
|||
def avis_params
|
||||
params.require(:avis).permit(:email, :introduction)
|
||||
end
|
||||
|
||||
def champs_private_params
|
||||
params.require(:dossier).permit(champs_private_attributes: [:id, :value, value: []])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,7 @@ class Dossier < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
|
||||
accepts_nested_attributes_for :champs
|
||||
accepts_nested_attributes_for :champs_private
|
||||
|
||||
default_scope { where(hidden_at: nil) }
|
||||
scope :state_brouillon, -> { where(state: BROUILLON) }
|
||||
|
|
|
@ -35,3 +35,16 @@
|
|||
- else
|
||||
%span.waiting En attente de réponse
|
||||
%p= avis.answer
|
||||
|
||||
- if @dossier.ordered_champs_private.present?
|
||||
%section
|
||||
%h1.private-annotations Annotations privées
|
||||
.card.featured
|
||||
= form_for @dossier, url: annotations_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
|
||||
= f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form|
|
||||
- champ = champ_form.object
|
||||
= render partial: "new_gestionnaire/dossiers/champs/#{champ.type_champ}",
|
||||
locals: { champ: champ, form: champ_form }
|
||||
|
||||
.send-wrapper
|
||||
= f.submit 'Sauvegarder', class: 'button send'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue