Skip to content

Commit

Permalink
Merge pull request #5582 from solidusio/elia/fix-select2-locales-load…
Browse files Browse the repository at this point in the history
…ing-with-precompiled-assets

Fix the check on select2 translations asset existence
  • Loading branch information
elia authored Jan 5, 2024
2 parents be5fea9 + 8f997be commit 5eeae45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/app/views/spree/admin/shared/_js_locale_data.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
<script data-hook='admin-custom-translations'>
</script>

<% 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'} %>
<% end %>

0 comments on commit 5eeae45

Please sign in to comment.