Fix date format in file versions modal [SCI-11223]

This commit is contained in:
Martin Artnik 2024-10-29 09:43:11 +01:00
parent aae0abcd67
commit 480754d3d4
3 changed files with 6 additions and 3 deletions

View file

@ -405,7 +405,8 @@ class AssetsController < ApplicationController
render(
json: ActiveModel::SerializableResource.new(
blobs,
each_serializer: ActiveStorage::BlobSerializer
each_serializer: ActiveStorage::BlobSerializer,
user: current_user
).as_json.merge(
enabled: VersionedAttachments.enabled?,
enable_url: ENV.fetch('SCINOTE_FILE_VERSIONING_ENABLE_URL', nil)

View file

@ -33,7 +33,7 @@
<div class="flex text-xs text-sn-grey justify-start">
<div class="mr-3">{{ fileVersion.attributes.created_at }}</div>
<div class="mr-3 text-nowrap text-ellipsis overflow-hidden max-w-52">{{ fileVersion.attributes.created_by.full_name }}</div>
<div>{{ Math.round(fileVersion.attributes.byte_size/1024) }}KB</div>
<div>{{ i18n.t("assets.file_versions_modal.size") }}: {{ Math.round(fileVersion.attributes.byte_size/1024) }}KB</div>
</div>
</div>

View file

@ -23,7 +23,9 @@ module ActiveStorage
end
def created_at
object.created_at.strftime('%B %d, %Y at %H:%M')
return object.created_at unless @instance_options[:user]
object.created_at.strftime("#{@instance_options[:user].date_format}, %H:%M")
end
def created_by