mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +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
|
||||
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
|
||||
def file_extension_icon(asset)
|
||||
file_ext = asset.file_file_name.split('.').last
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% if image_preview %>
|
||||
<%= image_tag image_preview %>
|
||||
<% else %>
|
||||
<i class="fas fa-image"></i>
|
||||
<i class="fas <%= file_fa_icon_class_v2(asset) %>"></i>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="attachment-label"><%= truncate(asset.file_file_name,
|
||||
|
|
Loading…
Reference in a new issue