From aa769f92f7069194b450dad543c69645f1578324 Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Thu, 14 Sep 2023 16:03:03 +0200 Subject: [PATCH] Fix missing icon files in exported projects [SCI-9133] --- .../team_zip_exports/load_handson.js | 17 ----------------- app/helpers/file_icons_helper.rb | 8 +++----- app/jobs/team_zip_export_job.rb | 1 + .../_my_module_result_asset_element.html.erb | 10 +++++----- .../elements/_step_asset_element.html.erb | 8 ++++---- app/views/team_zip_exports/report.html.erb | 3 --- config/initializers/assets.rb | 1 - 7 files changed, 13 insertions(+), 35 deletions(-) delete mode 100644 app/assets/javascripts/team_zip_exports/load_handson.js diff --git a/app/assets/javascripts/team_zip_exports/load_handson.js b/app/assets/javascripts/team_zip_exports/load_handson.js deleted file mode 100644 index cb5491b19..000000000 --- a/app/assets/javascripts/team_zip_exports/load_handson.js +++ /dev/null @@ -1,17 +0,0 @@ -/* global Handsontable */ -window.onload = function() { - var tables = document.getElementsByClassName('hot-table-container'); - var tableVals = document.getElementsByClassName('hot-table-contents'); - - for (let i = 0; i < tables.length; i += 1) { - tables[i].innerHTML = ''; - new Handsontable(tables[i], { - data: JSON.parse(tableVals[i].value).data, - rowHeaders: true, - colHeaders: true, - filters: true, - dropdownMenu: true, - formulas: true - }); - } -}; diff --git a/app/helpers/file_icons_helper.rb b/app/helpers/file_icons_helper.rb index adba2aab3..b6460e8c1 100644 --- a/app/helpers/file_icons_helper.rb +++ b/app/helpers/file_icons_helper.rb @@ -48,11 +48,9 @@ module FileIconsHelper image_link = Extends::FILE_ICON_MAPPINGS[file_ext] if Extends::FILE_ICON_MAPPINGS[file_ext] if image_link - if report - wicked_pdf_image_tag(image_link, class: 'image-icon') - else - ActionController::Base.helpers.image_tag(image_link, class: 'image-icon') - end + image_link = wicked_pdf_asset_base64(image_link) if report + + ActionController::Base.helpers.image_tag(image_link, class: 'image-icon') else '' end diff --git a/app/jobs/team_zip_export_job.rb b/app/jobs/team_zip_export_job.rb index 53a4fa9d1..5338a366d 100644 --- a/app/jobs/team_zip_export_job.rb +++ b/app/jobs/team_zip_export_job.rb @@ -2,6 +2,7 @@ require 'fileutils' require 'csv' +require 'vips' class TeamZipExportJob < ZipExportJob include StringUtility diff --git a/app/views/reports/elements/_my_module_result_asset_element.html.erb b/app/views/reports/elements/_my_module_result_asset_element.html.erb index 25c719b86..fe205856f 100644 --- a/app/views/reports/elements/_my_module_result_asset_element.html.erb +++ b/app/views/reports/elements/_my_module_result_asset_element.html.erb @@ -3,15 +3,15 @@ <% timestamp = asset.created_at %>
-
+ <%= file_extension_icon_html(asset, true) %> -
-
+ + <%= result.name %> <% if result.archived? %> <%= t('search.index.archived') %> <% end %> -
+
<% if defined? export_all and export_all %> <% file_link = @obj_filenames.dig(:assets, asset.id, :file) %> @@ -54,4 +54,4 @@
<% end %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/reports/elements/_step_asset_element.html.erb b/app/views/reports/elements/_step_asset_element.html.erb index 83a5f0c58..0b0f766a7 100644 --- a/app/views/reports/elements/_step_asset_element.html.erb +++ b/app/views/reports/elements/_step_asset_element.html.erb @@ -2,10 +2,10 @@ <% timestamp = asset.created_at %>
-
+ <%= file_extension_icon_html(asset, true) %> -
- +
 <%= t('projects.reports.elements.step_asset.user_time', timestamp: l(timestamp, format: :full)) %>
diff --git a/app/views/team_zip_exports/report.html.erb b/app/views/team_zip_exports/report.html.erb index 73827e12c..c1c6db5f0 100644 --- a/app/views/team_zip_exports/report.html.erb +++ b/app/views/team_zip_exports/report.html.erb @@ -23,9 +23,6 @@ nonce: true %> <% end %> - - <%= javascript_include_tag 'team_zip_exports/load_handson' %> - <%= title %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 1152b3a9a..a3eb3711c 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -103,7 +103,6 @@ Rails.application.config.assets.precompile += %w(users/invitations/resource_erro Rails.application.config.assets.precompile += %w(users/registrations/team_errors.js) Rails.application.config.assets.precompile += %w(users/registrations/resource_errors.js) Rails.application.config.assets.precompile += %w(users/registrations/new_with_provider.js) -Rails.application.config.assets.precompile += %w(team_zip_exports/load_handson.js) Rails.application.config.assets.precompile += %w(repository_columns/manage_column_partials/number.js) Rails.application.config.assets.precompile += %w(repository_columns/manage_column_partials/stock.js) Rails.application.config.assets.precompile += %w(shared/file_preview.js)