2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2020-09-17 17:09:16 +02:00
|
|
|
|
class Champs::TitreIdentiteChamp < Champ
|
2021-09-14 18:03:40 +02:00
|
|
|
|
FILE_MAX_SIZE = 20.megabytes
|
2022-11-21 17:53:29 +01:00
|
|
|
|
ACCEPTED_FORMATS = ['image/png', 'image/jpeg']
|
2024-04-23 14:51:59 +02:00
|
|
|
|
|
2024-05-07 16:41:20 +02:00
|
|
|
|
has_many_attached :piece_justificative_file
|
2024-04-23 14:51:59 +02:00
|
|
|
|
|
2024-04-01 07:36:14 +02:00
|
|
|
|
# TODO: if: -> { validate_champ_value? || validation_context == :prefill }
|
2021-11-24 10:04:20 +01:00
|
|
|
|
validates :piece_justificative_file, content_type: ACCEPTED_FORMATS, size: { less_than: FILE_MAX_SIZE }
|
2020-09-17 17:09:16 +02:00
|
|
|
|
|
|
|
|
|
def main_value_name
|
|
|
|
|
:piece_justificative_file
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def search_terms
|
|
|
|
|
# We don’t know how to search inside documents yet
|
|
|
|
|
end
|
|
|
|
|
end
|