Skip to content

Commit 2ee70d8

Browse files
authored
Merge pull request #1730 from bookernath/optimize-themeSettings-inject
Optimize themeSettings injection
2 parents eef1dfa + e4282d5 commit 2ee70d8

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

assets/js/theme/common/product-details.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export default class ProductDetails {
253253
if (_.isPlainObject(image)) {
254254
const zoomImageUrl = utils.tools.imageSrcset.getSrcset(
255255
image.data,
256-
{ '1x': this.context.themeSettings.zoom_size },
256+
{ '1x': this.context.zoomSize },
257257
/*
258258
Should match zoom size used for data-zoom-image in
259259
components/products/product-view.html
@@ -266,7 +266,7 @@ export default class ProductDetails {
266266

267267
const mainImageUrl = utils.tools.imageSrcset.getSrcset(
268268
image.data,
269-
{ '1x': this.context.themeSettings.product_size },
269+
{ '1x': this.context.productSize },
270270
/*
271271
Should match fallback image size used for the main product image in
272272
components/products/product-view.html

assets/js/theme/global.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import objectFitImages from './global/object-fit-polyfill';
2020
export default class Global extends PageManager {
2121
onReady() {
2222
const {
23-
channelId, cartId, productId, categoryId, secureBaseUrl, maintenanceModeSettings, adminBarLanguage, themeSettings,
23+
channelId, cartId, productId, categoryId, secureBaseUrl, maintenanceModeSettings, adminBarLanguage, showAdminBar,
2424
} = this.context;
2525
cartPreview(secureBaseUrl, cartId);
2626
quickSearch();
@@ -31,7 +31,7 @@ export default class Global extends PageManager {
3131
menu();
3232
mobileMenuToggle();
3333
privacyCookieNotification();
34-
if (themeSettings['show-admin-bar']) {
34+
if (showAdminBar) {
3535
adminBar(secureBaseUrl, channelId, maintenanceModeSettings, JSON.parse(adminBarLanguage), productId, categoryId);
3636
}
3737
loadingProgressBar();

templates/layout/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
{{{head.scripts}}}
3232

33-
{{~inject 'themeSettings' theme_settings}}
33+
{{~inject 'showAdminBar' theme_settings.show-admin-bar}}
3434
{{~inject 'genericError' (lang 'common.generic_error')}}
3535
{{~inject 'maintenanceModeSettings' settings.maintenance}}
3636
{{~inject 'adminBarLanguage' (langJson 'admin')}}

templates/pages/product.html

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
limit: {{theme_settings.productpage_similar_by_views_count}}
1111
---
1212
{{inject "productId" product.id}}
13+
{{inject "zoomSize" theme_settings.zoom_size}}
14+
{{inject "productSize" theme_settings.product_size}}
15+
1316
{{#partial "page"}}
1417

1518
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}}

0 commit comments

Comments
 (0)