refactor: renaming
This commit is contained in:
parent
6445337be7
commit
c8b3b4b45a
6 changed files with 9 additions and 9 deletions
|
@ -79,7 +79,7 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def set_all_pj
|
||||
@all_pj ||= @procedure.pieces_jointes_exportables_list
|
||||
@all_pj ||= @procedure.exportables_pieces_jointes
|
||||
end
|
||||
|
||||
def export_params
|
||||
|
|
|
@ -3,17 +3,17 @@ module PiecesJointesListConcern
|
|||
|
||||
included do
|
||||
def public_wrapped_partionned_pjs
|
||||
pieces_jointes_list(public_only: true, wrap_with_parent: true)
|
||||
pieces_jointes(public_only: true, wrap_with_parent: true)
|
||||
.partition { |(pj, _)| pj.condition.nil? }
|
||||
end
|
||||
|
||||
def pieces_jointes_exportables_list
|
||||
pieces_jointes_list(exclude_titre_identite: true)
|
||||
def exportables_pieces_jointes
|
||||
pieces_jointes(exclude_titre_identite: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pieces_jointes_list(
|
||||
def pieces_jointes(
|
||||
exclude_titre_identite: false,
|
||||
public_only: false,
|
||||
wrap_with_parent: false
|
||||
|
|
|
@ -13,7 +13,7 @@ class ExportTemplate < ApplicationRecord
|
|||
content["pdf_name"] = tiptap_json("export_")
|
||||
|
||||
content["pjs"] = []
|
||||
procedure.pieces_jointes_exportables_list.each do |pj|
|
||||
procedure.exportables_pieces_jointes.each do |pj|
|
||||
content["pjs"] << { "stable_id" => pj.stable_id.to_s, "path" => tiptap_json("#{pj.libelle.parameterize}-") }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ class ExportTemplateValidator < ActiveModel::Validator
|
|||
def validate_pjs(record)
|
||||
record.content["pjs"]&.each do |pj|
|
||||
pj_sym = pj.symbolize_keys
|
||||
libelle = record.groupe_instructeur.procedure.pieces_jointes_exportables_list.find { _1.stable_id.to_s == pj_sym[:stable_id] }&.libelle&.to_sym
|
||||
libelle = record.groupe_instructeur.procedure.exportables_pieces_jointes.find { _1.stable_id.to_s == pj_sym[:stable_id] }&.libelle&.to_sym
|
||||
validate_content(record, pj_sym[:path], libelle)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
%span#preview_default_dossier_directory= @export_template.tiptap_convert(sample_dossier, "default_dossier_directory")
|
||||
%ul
|
||||
%li#preview_pdf_name= @export_template.tiptap_convert(sample_dossier, "pdf_name")
|
||||
- @procedure.pieces_jointes_exportables_list.each do |pj|
|
||||
- @procedure.exportables_pieces_jointes.each do |pj|
|
||||
%li{ id: "preview_pj_#{pj.stable_id}" }= @export_template.tiptap_convert_pj(sample_dossier, pj.stable_id)
|
||||
%ul
|
||||
%li
|
||||
|
|
|
@ -44,7 +44,7 @@ describe PiecesJointesListConcern do
|
|||
end
|
||||
|
||||
it "returns the list of pieces jointes with private, without parent repetition, without titre identite" do
|
||||
expect(procedure.pieces_jointes_exportables_list.map(&:libelle)).to match_array([pj1, pj2, pjcond, pj5, pjcond2, pj6].map(&:libelle))
|
||||
expect(procedure.exportables_pieces_jointes.map(&:libelle)).to match_array([pj1, pj2, pjcond, pj5, pjcond2, pj6].map(&:libelle))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue