New helper for file thumbnails

This commit is contained in:
Urban Rotnik 2019-04-23 11:13:16 +02:00
parent ea0368aa11
commit b1dabaca15
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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,