4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/plutonium/helpers/table_helper.rb', line 4
def attachment_preview_thumnail(attachment)
return unless attachment.url.present?
tag.div class: "bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700", data: {attachment_preview_target: "thumbnail"} do
thumbnail_url = _attachment_thumbnail_url(attachment)
link_body = if thumbnail_url
image_tag thumbnail_url, style: "width:100%; height:100%; object-fit: contain;"
else
_attachment_extension(attachment)
end
link_to link_body, attachment.url, style: "width:150px; height:150px; line-height: 150px;",
class: "d-block text-decoration-none user-select-none fs-5 font-monospace text-body-secondary",
target: :blank,
data: {attachment_preview_target: "thumbnailLink"}
end
end
|