refactor(dossier): has_annotations?
This commit is contained in:
parent
9b26dedab4
commit
1193c866bf
4 changed files with 7 additions and 3 deletions
|
@ -1406,6 +1406,10 @@ class Dossier < ApplicationRecord
|
||||||
end.flat_map { champs_index[_1.stable_id] || [] }
|
end.flat_map { champs_index[_1.stable_id] || [] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_annotations?
|
||||||
|
revision.revision_types_de_champ_private.present?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_missing_traitemets
|
def create_missing_traitemets
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
= tab_item('le dossier',
|
= tab_item('le dossier',
|
||||||
apercu_admin_procedure_path(@dossier.procedure, tab: 'dossier'),
|
apercu_admin_procedure_path(@dossier.procedure, tab: 'dossier'),
|
||||||
active: @tab == 'dossier')
|
active: @tab == 'dossier')
|
||||||
- if @dossier.champs_private.size > 0
|
- if @dossier.has_annotations?
|
||||||
= tab_item('les annotations privées',
|
= tab_item('les annotations privées',
|
||||||
apercu_admin_procedure_path(@dossier.procedure, tab: 'annotations-privees'),
|
apercu_admin_procedure_path(@dossier.procedure, tab: 'annotations-privees'),
|
||||||
active: @tab == 'annotations-privees')
|
active: @tab == 'annotations-privees')
|
||||||
|
|
|
@ -349,7 +349,7 @@ prawn_document(page_size: "A4") do |pdf|
|
||||||
add_title(pdf, 'Formulaire')
|
add_title(pdf, 'Formulaire')
|
||||||
add_champs(pdf, @dossier.champs_public)
|
add_champs(pdf, @dossier.champs_public)
|
||||||
|
|
||||||
if @acls[:include_infos_administration] && @dossier.champs_private.present?
|
if @acls[:include_infos_administration] && @dossier.has_annotations?
|
||||||
add_title(pdf, "Annotations privées")
|
add_title(pdf, "Annotations privées")
|
||||||
add_champs(pdf, @dossier.champs_private)
|
add_champs(pdf, @dossier.champs_private)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.container.dossier-edit
|
.container.dossier-edit
|
||||||
- if dossier.champs_private.present?
|
- if dossier.has_annotations?
|
||||||
%section.counter-start-header-section
|
%section.counter-start-header-section
|
||||||
= render NestedForms::FormOwnerComponent.new
|
= render NestedForms::FormOwnerComponent.new
|
||||||
= form_for dossier, url: annotations_instructeur_dossier_path(dossier.procedure, dossier), html: { class: 'form', multipart: true } do |f|
|
= form_for dossier, url: annotations_instructeur_dossier_path(dossier.procedure, dossier), html: { class: 'form', multipart: true } do |f|
|
||||||
|
|
Loading…
Reference in a new issue