mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Add extendable file types mappings for icons [PIP-46]
This commit is contained in:
parent
e7f7fe9ff7
commit
aa933ad1f4
5 changed files with 24 additions and 6 deletions
|
@ -15,6 +15,11 @@ module FileIconsHelper
|
|||
image_link = 'office/PowerPoint-pptx_20x20x32.png'
|
||||
end
|
||||
|
||||
# Now check for custom mappings or possible overrides
|
||||
if Extends::FILE_ICON_MAPPINGS[file_ext]
|
||||
image_link = Extends::FILE_ICON_MAPPINGS[file_ext]
|
||||
end
|
||||
|
||||
if image_link
|
||||
image_tag image_link
|
||||
else
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
<% if wopi_file?(result.asset) %>
|
||||
<%= wopi_asset_file_name(result.asset) %>
|
||||
<% else %>
|
||||
<p><%= truncate(result.asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
||||
<p>
|
||||
<%= file_extension_icon(result.asset) %>
|
||||
<%= truncate(result.asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= wopi_result_view_file_button(result) %>
|
||||
|
|
|
@ -123,8 +123,11 @@
|
|||
<% else %>
|
||||
<%= image_tag asset.url(:medium) if asset.is_image? %>
|
||||
<% end %>
|
||||
<p><%= truncate(asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
||||
<p>
|
||||
<%= file_extension_icon(asset) %>
|
||||
<%= truncate(asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %>
|
||||
</p>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
<% if wopi_file?(asset) %>
|
||||
<%= wopi_asset_file_name(asset) %>
|
||||
<% else %>
|
||||
<p><%= truncate(asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
||||
<p>
|
||||
<%= file_extension_icon(asset) %>
|
||||
<%= truncate(asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= wopi_asset_view_button(asset) %>
|
||||
|
|
|
@ -50,4 +50,8 @@ class Extends
|
|||
API_PLUGABLE_AUTH_METHODS = []
|
||||
|
||||
OMNIAUTH_PROVIDERS = []
|
||||
|
||||
# Hash used for mapping file extensions to custom icons,
|
||||
# 'extension' => 'path_to_the_icon'
|
||||
FILE_ICON_MAPPINGS = {}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue