mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Only load Google Maps JS where it's actually needed
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
- 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
|
||||
|
||||
@@ -42,13 +42,10 @@
|
||||
|
||||
- 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
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
- 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
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
- 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)
|
||||
|
||||
@@ -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
|
||||
|
||||
2
app/views/shared/_google_maps_js.html.haml
Normal file
2
app/views/shared/_google_maps_js.html.haml
Normal 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'] : ''} "}
|
||||
@@ -1,6 +1,9 @@
|
||||
- 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)
|
||||
|
||||
Reference in New Issue
Block a user