diff --git a/app/javascript/vue/protocol/attachments.vue b/app/javascript/vue/protocol/attachments.vue index bfa6ea8c1..6022a3e27 100644 --- a/app/javascript/vue/protocol/attachments.vue +++ b/app/javascript/vue/protocol/attachments.vue @@ -4,7 +4,7 @@

{{ i18n.t('protocols.steps.files', {count: attachments.length}) }}

-
+
-
{{ attachment.attributes.file_name }} diff --git a/app/serializers/asset_serializer.rb b/app/serializers/asset_serializer.rb index 8e40960d4..004d34b5a 100644 --- a/app/serializers/asset_serializer.rb +++ b/app/serializers/asset_serializer.rb @@ -11,7 +11,7 @@ class AssetSerializer < ActiveModel::Serializer attributes :file_name, :view_mode, :icon, :urls, :updated_at_formatted, :file_size, :medium_preview, :large_preview, :asset_type, :wopi, :wopi_context, :pdf_previewable, :file_size_formatted, :asset_order, - :updated_at, :metadata, :image_editable, :image_context, :pdf + :updated_at, :metadata, :image_editable, :image_context, :pdf, :attached def icon file_fa_icon_class(object) @@ -29,6 +29,10 @@ class AssetSerializer < ActiveModel::Serializer I18n.l(object.updated_at, format: :full_date) if object.updated_at end + def attached + object.file.attached? + end + def file_size_formatted number_to_human_size(object.file_size) end @@ -106,7 +110,7 @@ class AssetSerializer < ActiveModel::Serializer def urls urls = { preview: asset_file_preview_path(object), - download: rails_blob_path(object.file, disposition: 'attachment'), + download: (rails_blob_path(object.file, disposition: 'attachment') if attached), load_asset: load_asset_path(object), asset_file: asset_file_url_path(object), marvin_js: marvin_js_asset_path(object),