refactor(pj): more readable as_multiple logic
This commit is contained in:
parent
9e3bf50e61
commit
0dd4bafdfd
3 changed files with 1 additions and 9 deletions
|
@ -8,7 +8,7 @@
|
||||||
= render Attachment::EditComponent.new(champ:, attached_file:, attachment:, index:, view_as:, user_can_destroy:, form_object_name:)
|
= 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 } }
|
%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
|
// single poll and refresh message for all attachments
|
||||||
= render Attachment::PendingPollComponent.new(attachments: attachments, poll_url:, context: poll_context)
|
= render Attachment::PendingPollComponent.new(attachments: attachments, poll_url:, context: poll_context)
|
||||||
|
|
|
@ -30,8 +30,4 @@ class Champs::PieceJustificativeChamp < Champ
|
||||||
def blank?
|
def blank?
|
||||||
piece_justificative_file.blank?
|
piece_justificative_file.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow_multiple_attachments?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,8 +25,4 @@ class Champs::TitreIdentiteChamp < Champ
|
||||||
def blank?
|
def blank?
|
||||||
piece_justificative_file.blank?
|
piece_justificative_file.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow_multiple_attachments?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue