mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 19:06:23 +00:00
asociar el archivo subido al post
This commit is contained in:
parent
03d9913f58
commit
fdbe724f7c
1 changed files with 23 additions and 7 deletions
|
@ -43,13 +43,7 @@ class MetadataFile < MetadataTemplate
|
||||||
# repetida.
|
# repetida.
|
||||||
def save
|
def save
|
||||||
value['description'] = sanitize value['description']
|
value['description'] = sanitize value['description']
|
||||||
|
value['path'] = static_file ? relative_destination_path_with_filename.to_s : nil
|
||||||
if path?
|
|
||||||
hardlink
|
|
||||||
value['path'] = relative_destination_path
|
|
||||||
else
|
|
||||||
value['path'] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -110,6 +104,28 @@ class MetadataFile < MetadataTemplate
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Obtener la ruta al archivo relativa al sitio
|
||||||
|
#
|
||||||
|
# @return [Pathname]
|
||||||
|
def destination_path
|
||||||
|
Pathname.new(static_file_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Agrega el nombre de archivo a la ruta para tener retrocompatibilidad
|
||||||
|
#
|
||||||
|
# @return [Pathname]
|
||||||
|
def destination_path_with_filename
|
||||||
|
destination_path.realpath
|
||||||
|
end
|
||||||
|
|
||||||
|
def relative_destination_path_with_filename
|
||||||
|
destination_path_with_filename.relative_path_from(site.path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def static_file_path
|
||||||
|
static_file.blob.service.path_for(static_file.key)
|
||||||
|
end
|
||||||
|
|
||||||
# No hay archivo pero se lo describió
|
# No hay archivo pero se lo describió
|
||||||
def no_file_for_description?
|
def no_file_for_description?
|
||||||
!path? && description?
|
!path? && description?
|
||||||
|
|
Loading…
Reference in a new issue