From f7c776a1043b4918771c86ff5c1ac996fc20f79e Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Fri, 5 Jan 2024 13:27:08 +0100 Subject: [PATCH] Fix the check on select2 translations asset existence In environment expecting precompiled assets `Rails.application.assets` is `nil` and we should fall back on checking the manifest. --- .../views/spree/admin/shared/_js_locale_data.html.erb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/app/views/spree/admin/shared/_js_locale_data.html.erb b/backend/app/views/spree/admin/shared/_js_locale_data.html.erb index 6727676860e..38a032080d9 100644 --- a/backend/app/views/spree/admin/shared/_js_locale_data.html.erb +++ b/backend/app/views/spree/admin/shared/_js_locale_data.html.erb @@ -33,7 +33,10 @@ -<% if I18n.locale != :en && I18n.locale %> - <% select2_locale_path = "solidus_admin/select2_locales/select2_locale_#{I18n.locale}" %> - <%= javascript_include_tag select2_locale_path, data: {turbolinks_track: 'reload'} if Rails.application.assets.find_asset(select2_locale_path) %> +<% select2_locale_path = "solidus_admin/select2_locales/select2_locale_#{I18n.locale}.js" %> +<% if I18n.locale != :en && I18n.locale && ( + Rails.application.assets&.find_asset(select2_locale_path) || # compiled on the fly + Rails.application.assets_manifest.assets[select2_locale_path] # precompiled +) %> + <%= javascript_include_tag select2_locale_path, data: {turbolinks_track: 'reload'} if select2_locale_exists %> <% end %>