refactor(pj): more readable as_multiple logic

This commit is contained in:
Colin Darie 2024-04-25 12:11:48 +02:00 committed by Kara Diaby
parent 9e3bf50e61
commit 0dd4bafdfd
3 changed files with 1 additions and 9 deletions

View file

@ -8,7 +8,7 @@
= render Attachment::EditComponent.new(champ:, attached_file:, attachment:, index:, view_as:, user_can_destroy:, form_object_name:)
%div{ id: empty_component_id, class: class_names("hidden": !can_attach_next?), data: { turbo_force: :server } }
= render Attachment::EditComponent.new(champ:, as_multiple: champ.present? ? champ.allow_multiple_attachments? : true, attached_file:, attachment: nil, index: attachments_count, user_can_destroy:, form_object_name:)
= render Attachment::EditComponent.new(champ:, as_multiple: champ.nil?, attached_file:, attachment: nil, index: attachments_count, user_can_destroy:, form_object_name:)
// single poll and refresh message for all attachments
= render Attachment::PendingPollComponent.new(attachments: attachments, poll_url:, context: poll_context)

View file

@ -30,8 +30,4 @@ class Champs::PieceJustificativeChamp < Champ
def blank?
piece_justificative_file.blank?
end
def allow_multiple_attachments?
false
end
end

View file

@ -25,8 +25,4 @@ class Champs::TitreIdentiteChamp < Champ
def blank?
piece_justificative_file.blank?
end
def allow_multiple_attachments?
false
end
end