no se puede enviar archivo sin descripcion closes #217
This commit is contained in:
parent
085c2028a2
commit
1df7e8fbd0
3 changed files with 17 additions and 3 deletions
|
@ -16,7 +16,8 @@ class MetadataFile < MetadataTemplate
|
|||
def validate
|
||||
super
|
||||
|
||||
errors << I18n.t('metadata.image.path_required') if path_missing?
|
||||
errors << I18n.t("metadata.#{type}.path_required") if path_missing?
|
||||
errors << I18n.t("metadata.#{type}.no_file_for_description") if no_file_for_description?
|
||||
|
||||
errors.compact!
|
||||
errors.empty?
|
||||
|
@ -128,4 +129,9 @@ class MetadataFile < MetadataTemplate
|
|||
def destination_path
|
||||
File.join(site.path, relative_destination_path)
|
||||
end
|
||||
|
||||
# No hay archivo pero se lo describió
|
||||
def no_file_for_description?
|
||||
value['description'].present? && value['path'].blank?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,11 @@ en:
|
|||
cant_be_empty: 'This field cannot be empty'
|
||||
image:
|
||||
not_an_image: 'Not an image'
|
||||
path_required: 'Missing file for upload'
|
||||
path_required: 'Missing image for upload'
|
||||
no_file_for_description: "There's a description with no associated image"
|
||||
file:
|
||||
path_required: "Missing file for upload"
|
||||
no_file_for_description: "There's a description with no associated file"
|
||||
event:
|
||||
zone_missing: 'Timezone is incorrect'
|
||||
date_missing: 'Event date is required'
|
||||
|
|
|
@ -35,7 +35,11 @@ es:
|
|||
cant_be_empty: 'El campo no puede estar vacío'
|
||||
image:
|
||||
not_an_image: 'No es una imagen'
|
||||
path_required: 'Se necesita un archivo de imagen'
|
||||
path_required: 'Se necesita una imagen'
|
||||
no_file_for_description: 'Se envió una descripción sin imagen asociada'
|
||||
file:
|
||||
path_required: 'Se necesita un archivo'
|
||||
no_file_for_description: 'se envió una descripción sin archivo asociado'
|
||||
event:
|
||||
zone_missing: 'El huso horario no es correcto'
|
||||
date_missing: 'La fecha es obligatoria'
|
||||
|
|
Loading…
Reference in a new issue