diff --git a/app/helpers/file_icons_helper.rb b/app/helpers/file_icons_helper.rb index e12c51fd7..877248220 100644 --- a/app/helpers/file_icons_helper.rb +++ b/app/helpers/file_icons_helper.rb @@ -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 diff --git a/app/views/results/_result_asset.html.erb b/app/views/results/_result_asset.html.erb index b38409131..8dfcb55a6 100644 --- a/app/views/results/_result_asset.html.erb +++ b/app/views/results/_result_asset.html.erb @@ -20,8 +20,11 @@ <% if wopi_file?(result.asset) %> <%= wopi_asset_file_name(result.asset) %> <% else %> -

<%= truncate(result.asset.file_file_name, - length: Constants::FILENAME_TRUNCATION_LENGTH) %>

+

+ <%= file_extension_icon(result.asset) %> + <%= truncate(result.asset.file_file_name, + length: Constants::FILENAME_TRUNCATION_LENGTH) %> +

<% end %> <% end %> <%= wopi_result_view_file_button(result) %> diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index fc57e310b..e3fc6cbab 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -123,8 +123,11 @@ <% else %> <%= image_tag asset.url(:medium) if asset.is_image? %> <% end %> -

<%= truncate(asset.file_file_name, - length: Constants::FILENAME_TRUNCATION_LENGTH) %>

+

+ <%= file_extension_icon(asset) %> + <%= truncate(asset.file_file_name, + length: Constants::FILENAME_TRUNCATION_LENGTH) %> +

<% end %> <% end %> diff --git a/app/views/steps/_wopi_controlls.html.erb b/app/views/steps/_wopi_controlls.html.erb index 73b330355..472f1a824 100644 --- a/app/views/steps/_wopi_controlls.html.erb +++ b/app/views/steps/_wopi_controlls.html.erb @@ -7,8 +7,11 @@ <% if wopi_file?(asset) %> <%= wopi_asset_file_name(asset) %> <% else %> -

<%= truncate(asset.file_file_name, - length: Constants::FILENAME_TRUNCATION_LENGTH) %>

+

+ <%= file_extension_icon(asset) %> + <%= truncate(asset.file_file_name, + length: Constants::FILENAME_TRUNCATION_LENGTH) %> +

<% end %> <% end %> <%= wopi_asset_view_button(asset) %> diff --git a/config/initializers/extends.rb b/config/initializers/extends.rb index 27495f574..cebef7c6e 100644 --- a/config/initializers/extends.rb +++ b/config/initializers/extends.rb @@ -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