Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pxska committed Feb 10, 2022
1 parent d514ee0 commit 4acdc0f
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 44 deletions.
7 changes: 0 additions & 7 deletions components/template-variables.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{% capture dont_render %}
{% comment %}Detects viewing mode.{% endcomment %}
{% if editmode %}
{% assign view_mode = "editmode" %}
{% else %}
{% assign view_mode = "publicmode" %}
{% endif %}

{% comment %}SITE BODY RELATED VARIABLES.{% endcomment %}
{% comment %}Assign variables based on page type.{% endcomment %}
{% if blog_article_page %}
Expand Down
5 changes: 1 addition & 4 deletions javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ MMCQ = (function() {
// Enables the usage of the initiations outside this file.
// For example add "<script>site.initBlogPage();</script>" at the end of the "Blog & News" page to initiate blog listing view functions.
window.site = $.extend(window.site || {}, {
handleProductPageContent: handleProductPageContent,
initFrontPage: initFrontPage,
initCommonPage: initCommonPage,
initProductPage: initProductPage,
Expand All @@ -746,10 +747,6 @@ MMCQ = (function() {
bindSiteSearch: bindSiteSearch
});

window.template = $.extend(window.template || {}, {
handleProductPageContent: handleProductPageContent
});

// Initiates site wide functions.
init();
})(jQuery);
2 changes: 1 addition & 1 deletion javascripts/application.min.js

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions javascripts/editmode.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
; (function ($) {
var editmode = function () {
return $('html').hasClass('editmode');
};

// Returns the suitable version of the image depending on the viewport width.
var getImageByWidth = function (sizes, targetWidth) {
var prevImage;
Expand Down Expand Up @@ -480,11 +476,9 @@
// 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();
});
}
$('.product-content .product-image').click(function() {
window.open('/admin/ecommerce/products/' + product_id, '_blank').focus();
});
};

var init = function () {
Expand Down
2 changes: 1 addition & 1 deletion javascripts/editmode.min.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions layouts/auto_generated_product.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
{% include "template-variables" %}

<html class="{% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}" data-view-state="{{ view_mode }}">
<html class="{% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}">

<head prefix="og: http://ogp.me/ns#">
{% include "html-head" %}
Expand Down Expand Up @@ -114,10 +114,12 @@
{% include "template-tools" %}

<script>
template && template.handleProductPageContent();
{%- if editmode and product %}
site && site.handleProductImageClick({{ product.id }});
{% endif -%}
if (site) {
site.handleProductPageContent();
{%- if editmode and product %}
site.handleProductImageClick({{ product.id }});
{% endif -%}
}
</script>
</body>

Expand Down
2 changes: 1 addition & 1 deletion layouts/product.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<div class="mar_0-32 flex_col">
<section class="content-body content-formatted js-buy-btn-content mar_32-0"
data-search-indexing-allowed="true">
<div class="content-item-title content-area" data-search-indexing-allowed="true">
<div class="content-item-title content-area">
{% contentblock name="page_title" publish_default_content="true" %}
<h1>{{ page.title }}</h1>
{% endcontentblock %}
Expand Down
12 changes: 3 additions & 9 deletions sources/javascripts/concat/editmode/editmode.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
; (function ($) {
var editmode = function () {
return $('html').hasClass('editmode');
};

// Returns the suitable version of the image depending on the viewport width.
var getImageByWidth = function (sizes, targetWidth) {
var prevImage;
Expand Down Expand Up @@ -480,11 +476,9 @@
// 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();
});
}
$('.product-content .product-image').click(function() {
window.open('/admin/ecommerce/products/' + product_id, '_blank').focus();
});
};

var init = function () {
Expand Down
5 changes: 1 addition & 4 deletions sources/javascripts/concat/global/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
// Enables the usage of the initiations outside this file.
// For example add "<script>site.initBlogPage();</script>" at the end of the "Blog & News" page to initiate blog listing view functions.
window.site = $.extend(window.site || {}, {
handleProductPageContent: handleProductPageContent,
initFrontPage: initFrontPage,
initCommonPage: initCommonPage,
initProductPage: initProductPage,
Expand All @@ -205,10 +206,6 @@
bindSiteSearch: bindSiteSearch
});

window.template = $.extend(window.template || {}, {
handleProductPageContent: handleProductPageContent
});

// Initiates site wide functions.
init();
})(jQuery);
2 changes: 1 addition & 1 deletion sources/stylesheets/components/_image-drop-area.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
overflow: hidden;
margin-top: 10px;

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

Expand Down
2 changes: 1 addition & 1 deletion stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ body.dark-background {
left: 0;
}

[data-view-state="editmode"] .item-top {
.editmode .item-top {
cursor: pointer;
}

Expand Down
2 changes: 1 addition & 1 deletion stylesheets/main.min.css

Large diffs are not rendered by default.

0 comments on commit 4acdc0f

Please sign in to comment.