mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-04 19:05:37 +08:00
New helper for file thumbnails
This commit is contained in:
parent
ea0368aa11
commit
b1dabaca15
2 changed files with 13 additions and 1 deletions
|
@ -28,6 +28,18 @@ module FileIconsHelper
|
||||||
fa_class
|
fa_class
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def file_fa_icon_class_v2(asset)
|
||||||
|
file_ext = asset.file_file_name.split('.').last
|
||||||
|
|
||||||
|
if Constants::FILE_TEXT_FORMATS.include?(file_ext)
|
||||||
|
return 'fa-file-alt'
|
||||||
|
elsif Constants::WHITELISTED_IMAGE_TYPES.include?(file_ext)
|
||||||
|
return 'fa-image'
|
||||||
|
else
|
||||||
|
return 'fa-paperclip'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# For showing next to file
|
# For showing next to file
|
||||||
def file_extension_icon(asset)
|
def file_extension_icon(asset)
|
||||||
file_ext = asset.file_file_name.split('.').last
|
file_ext = asset.file_file_name.split('.').last
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<% if image_preview %>
|
<% if image_preview %>
|
||||||
<%= image_tag image_preview %>
|
<%= image_tag image_preview %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<i class="fas fa-image"></i>
|
<i class="fas <%= file_fa_icon_class_v2(asset) %>"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="attachment-label"><%= truncate(asset.file_file_name,
|
<div class="attachment-label"><%= truncate(asset.file_file_name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue