mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 01:56:22 +00:00
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
|
def validate
|
||||||
super
|
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.compact!
|
||||||
errors.empty?
|
errors.empty?
|
||||||
|
@ -128,4 +129,9 @@ class MetadataFile < MetadataTemplate
|
||||||
def destination_path
|
def destination_path
|
||||||
File.join(site.path, relative_destination_path)
|
File.join(site.path, relative_destination_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# No hay archivo pero se lo describió
|
||||||
|
def no_file_for_description?
|
||||||
|
value['description'].present? && value['path'].blank?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,7 +35,11 @@ en:
|
||||||
cant_be_empty: 'This field cannot be empty'
|
cant_be_empty: 'This field cannot be empty'
|
||||||
image:
|
image:
|
||||||
not_an_image: 'Not an 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:
|
event:
|
||||||
zone_missing: 'Timezone is incorrect'
|
zone_missing: 'Timezone is incorrect'
|
||||||
date_missing: 'Event date is required'
|
date_missing: 'Event date is required'
|
||||||
|
|
|
@ -35,7 +35,11 @@ es:
|
||||||
cant_be_empty: 'El campo no puede estar vacío'
|
cant_be_empty: 'El campo no puede estar vacío'
|
||||||
image:
|
image:
|
||||||
not_an_image: 'No es una imagen'
|
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:
|
event:
|
||||||
zone_missing: 'El huso horario no es correcto'
|
zone_missing: 'El huso horario no es correcto'
|
||||||
date_missing: 'La fecha es obligatoria'
|
date_missing: 'La fecha es obligatoria'
|
||||||
|
|
Loading…
Reference in a new issue