Merge pull request #8060 from Matt-Yorkley/script-split

Maps and AMS conditional loading
This commit is contained in:
Matt-Yorkley
2021-08-21 16:35:46 +02:00
committed by GitHub
8 changed files with 38 additions and 8 deletions

View File

@@ -8,6 +8,10 @@
- content_for :injection_data do
- cache(*CacheService::FragmentCaching.ams_shop(@enterprise)) do
= inject_enterprise_shopfront(@enterprise)
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
%shop.darkswarm
- if @shopfront_layout == 'embedded'

View File

@@ -5,10 +5,17 @@
- content_for(:image) do
= @group.logo.url
- content_for :scripts do
= render partial: "shared/google_maps_js"
- content_for :injection_data do
= inject_available_countries
= inject_group_enterprises
= inject_open_street_map_config
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
#group-page.row.pad-top.footer-pad{"ng-controller" => "GroupPageCtrl"}
.small-12.columns.pad-top

View File

@@ -42,22 +42,15 @@
- if Spree::Config.stripe_connect_enabled
= render "shared/stripe_js"
- if !ContentConfig.open_street_map_enabled
%script{src: "//maps.googleapis.com/maps/api/js?libraries=places,geometry#{ ENV['GOOGLE_MAPS_API_KEY'] ? '&key=' + ENV['GOOGLE_MAPS_API_KEY'] : ''} "}
= javascript_include_tag "darkswarm/all"
= javascript_include_tag "web/all"
= render "layouts/i18n_script"
= yield :scripts
= inject_current_hub
= inject_current_user
= inject_rails_flash
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
= inject_current_order
= inject_currency_config
= yield :injection_data

View File

@@ -1,9 +1,16 @@
- content_for(:title) do
= t :map_title
- content_for :scripts do
= render partial: "shared/google_maps_js"
- content_for :injection_data do
= inject_available_countries
= inject_enterprise_shopfront_list
= inject_open_street_map_config
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
= render partial: "shared/map"

View File

@@ -1,9 +1,16 @@
- content_for(:title) do
= t :producers_title
- content_for :scripts do
= render partial: "shared/google_maps_js"
- content_for :injection_data do
- cache @enterprises do
= inject_enterprises(@enterprises)
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
.producers{"ng-controller" => "EnterprisesCtrl", "ng-cloak" => true}
.row

View File

@@ -1,6 +1,9 @@
- content_for(:title) do
= t :register_title
- content_for :scripts do
= render partial: "shared/google_maps_js"
- content_for :injection_data do
= inject_spree_api_key
= inject_available_countries

View File

@@ -0,0 +1,2 @@
- if !ContentConfig.open_street_map_enabled
%script{src: "//maps.googleapis.com/maps/api/js?libraries=places,geometry#{ ENV['GOOGLE_MAPS_API_KEY'] ? '&key=' + ENV['GOOGLE_MAPS_API_KEY'] : ''} "}

View File

@@ -1,9 +1,16 @@
- content_for(:title) do
= t :shops_title
- content_for :scripts do
= render partial: "shared/google_maps_js"
- content_for :injection_data do
- cache(*CacheService::FragmentCaching.ams_shops) do
= inject_enterprises(@enterprises)
- cache(*CacheService::FragmentCaching.ams_all_taxons) do
= inject_taxons
- cache(*CacheService::FragmentCaching.ams_all_properties) do
= inject_properties
#panes
#shops.pane