Skip to content

Commit

Permalink
Add multi-assets support to auto-gen pr. page
Browse files Browse the repository at this point in the history
  • Loading branch information
PeeterPaal committed Nov 30, 2023
1 parent d954332 commit c0188b1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 45 deletions.
11 changes: 0 additions & 11 deletions javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1184,16 +1184,6 @@
}
};

// Opens product admin view on product image click

var handleProductImageClick = function(product_id) {
if (editmode()) {
$('.product-content .product-image').click(function() {
window.open('/admin/ecommerce/products/' + product_id, '_blank').focus();
});
}
};

// Enables the usage of the initiations outside this file.
window.site = $.extend(window.site || {}, {
bgPickerColorScheme: bgPickerColorScheme,
Expand All @@ -1204,7 +1194,6 @@
bindLanguageMenuSettings: bindLanguageMenuSettings,
bindRootItemSettings: bindRootItemSettings,
bindSiteSearch: bindSiteSearch,
handleProductImageClick: handleProductImageClick,
handleProductPageContent: handleProductPageContent,
initArticlePage: initArticlePage,
initBlogPage: initBlogPage,
Expand Down
2 changes: 1 addition & 1 deletion javascripts/main.min.js

Large diffs are not rendered by default.

26 changes: 10 additions & 16 deletions layouts/auto_generated_product.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,18 @@
<div class="flex-col">
<div class="content-illustrations">

{%- if product.image != blank %}
{% assign item_image_state = "with-image" %}
{% else %}
{% assign item_image_state = "without-image" %}
{% endif -%}
{%- if product.photos != blank -%}
{%- assign item_image_state = "with-images" -%}
{%- else -%}
{%- assign item_image_state = "without-images" -%}
{%- endif -%}

<div class="content-item-box {{ item_image_state }} js-content-item-box">
<div class="item-top product-image">
{%- if product.image != blank -%}
<div class="top-inner aspect-ratio-inner product-page-image">
{%- assign image_class = "item-image not-cropped" -%}
{% image product.image target_width: "600" class: image_class loading: "lazy" %}
</div>
{%- endif -%}
</div>
{%- if product.photos == blank -%}
<div class="item-top without-pointer"></div>
{%- else -%}
{% gallery product layout="product_slider" %}
{%- endif -%}
</div>

{%- if gallery_content_size > 0 or editmode -%}
Expand Down Expand Up @@ -202,9 +199,6 @@
if (site) {
site.initWindowResize();
site.handleProductPageContent();
{%- if product and editmode %}
site.handleProductImageClick({{ product.id }});
{% endif -%}
}
</script>
</body>
Expand Down
11 changes: 0 additions & 11 deletions sources/javascripts/concat/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,16 +1129,6 @@
}
};

// Opens product admin view on product image click

var handleProductImageClick = function(product_id) {
if (editmode()) {
$('.product-content .product-image').click(function() {
window.open('/admin/ecommerce/products/' + product_id, '_blank').focus();
});
}
};

// Enables the usage of the initiations outside this file.
window.site = $.extend(window.site || {}, {
bgPickerColorScheme: bgPickerColorScheme,
Expand All @@ -1149,7 +1139,6 @@
bindLanguageMenuSettings: bindLanguageMenuSettings,
bindRootItemSettings: bindRootItemSettings,
bindSiteSearch: bindSiteSearch,
handleProductImageClick: handleProductImageClick,
handleProductPageContent: handleProductPageContent,
initArticlePage: initArticlePage,
initBlogPage: initBlogPage,
Expand Down
6 changes: 4 additions & 2 deletions sources/stylesheets/components/_content-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@
.item-top {
@include aspect-ratio(1, 1);

[data-view-state="editmode"] & {
cursor: pointer;
&:not(.without-pointer) {
[data-view-state="editmode"] & {
cursor: pointer;
}
}

&:hover {
Expand Down
2 changes: 1 addition & 1 deletion sources/stylesheets/layouts/_auto-generated-product.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.product-content {
.without-image .item-top {
.without-images .item-top {
background-image: url("../assets/ico-placeholder.svg");
background-size: 40px;
background-repeat: no-repeat;
Expand Down
4 changes: 2 additions & 2 deletions stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@ a img {
margin: 20px 0;
}

.product-content .without-image .item-top {
.product-content .without-images .item-top {
background-image: url("../assets/ico-placeholder.svg");
background-size: 40px;
background-repeat: no-repeat;
Expand Down Expand Up @@ -4204,7 +4204,7 @@ a img {
bottom: 0;
left: 0;
}
[data-view-state=editmode] .item-top {
[data-view-state=editmode] .item-top:not(.without-pointer) {
cursor: pointer;
}
.item-top:hover .btn,
Expand Down
2 changes: 1 addition & 1 deletion stylesheets/main.min.css

Large diffs are not rendered by default.

0 comments on commit c0188b1

Please sign in to comment.