diff --git a/Gruntfile.js b/Gruntfile.js
index 5adc3ea..a72e21b 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -234,7 +234,7 @@ module.exports = function(grunt) {
},
js_concat: {
- files: 'sources/javascripts/concat/**/*.js',
+ files: ['sources/javascripts/concat/**/*.js', 'sources/javascripts/concat/editmode/*.js'],
tasks: ['concat', 'uglify:build', 'exec:kitmanifest', 'exec:kit:javascripts/*.js']
},
diff --git a/components/article-settings-variables.tpl b/components/article-settings-variables.tpl
new file mode 100644
index 0000000..5df4700
--- /dev/null
+++ b/components/article-settings-variables.tpl
@@ -0,0 +1,19 @@
+{%- assign articleSettingsData = article.data.article_settings -%}
+
+{% assign article_data_show_date_defined = false %}
+{% if article.data.article_settings.show_date == true or article.data.article_settings.show_date == false %}
+ {% assign show_article_date = article.data.article_settings.show_date %}
+ {% assign article_data_show_date_defined = true %}
+{% elsif site.data.article_settings.show_dates == false %}
+ {% assign show_article_date = false %}
+{% else %}
+ {% assign show_article_date = true %}
+{% endif %}
+
+{% if article.data.article_settings.show_comments == true or article.data.article_settings.show_comments == false %}
+ {% assign show_article_comments = article.data.article_settings.show_comments %}
+{% elsif site.data.article_settings.show_comments == false %}
+ {% assign show_article_comments = false %}
+{% else %}
+ {% assign show_article_comments = true %}
+{% endif %}
diff --git a/components/edicy-tools.tpl b/components/edicy-tools.tpl
index a841cbf..ecf90f1 100644
--- a/components/edicy-tools.tpl
+++ b/components/edicy-tools.tpl
@@ -1,5 +1,10 @@
{% editorjsblock %}
+
+ {% if _isSettingsEditor == true %}
+ {% include "settings-editor" %}
+ {% endif %}
+
diff --git a/components/settings-blog-page.tpl b/components/settings-blog-page.tpl
new file mode 100644
index 0000000..fdc3249
--- /dev/null
+++ b/components/settings-blog-page.tpl
@@ -0,0 +1,73 @@
+{% include 'settings-editor-button',
+ _titleKey: "blog",
+ _descriptionKey: "edit_blog_settings",
+ _className: "js-blog-settings-editor",
+ _wrapClassName: "content_settings-btn"
+%}
+
+
diff --git a/components/settings-editor-button.tpl b/components/settings-editor-button.tpl
new file mode 100644
index 0000000..0df6e33
--- /dev/null
+++ b/components/settings-editor-button.tpl
@@ -0,0 +1,17 @@
+
+
+
diff --git a/components/settings-editor.tpl b/components/settings-editor.tpl
new file mode 100644
index 0000000..e03726e
--- /dev/null
+++ b/components/settings-editor.tpl
@@ -0,0 +1,70 @@
+{% if editmode %}
+
+{% endif %}
diff --git a/components/settings-popover.tpl b/components/settings-popover.tpl
new file mode 100644
index 0000000..1a6cf04
--- /dev/null
+++ b/components/settings-popover.tpl
@@ -0,0 +1,29 @@
+{%- if editmode -%}
+
+ {%- if _blogPage == true -%}
+ {% include 'settings-blog-page' %}
+ {% include "edicy-tools", _isSettingsEditor: true %}
+ {%- elsif _articlePage == true -%}
+ {% include 'settings-article-page' %}
+ {% include "edicy-tools", _isSettingsEditor: true %}
+ {%- endif -%}
+
+
+
+
+
+
+ {{ 'design_settings' | lce | escape_once }}
+{%- endif -%}
diff --git a/components/template-cs-product-list.tpl b/components/template-cs-product-list.tpl
index 21591be..5184d5a 100644
--- a/components/template-cs-product-list.tpl
+++ b/components/template-cs-product-list.tpl
@@ -8,4 +8,4 @@
"scope": "global"
*/
--product-list-item__width: 33.3%;
-}
\ No newline at end of file
+}
diff --git a/javascripts/application.js b/javascripts/application.js
index ab3bbf5..bf1b374 100644
--- a/javascripts/application.js
+++ b/javascripts/application.js
@@ -540,74 +540,54 @@ MMCQ = (function() {
}).call(this);
(function ($) {
- $(function () {
- // Function to limit the rate at which a function can fire.
- var debounce = function (func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function () {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
+
+ // Function to limit the rate at which a function can fire.
+ var debounce = function (func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function () {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
};
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
};
+ };
- $(".mobile-menu-toggler").click(function (event) {
- event.preventDefault();
- $("body").toggleClass("mobilemenu-open");
- $("body").removeClass("mobilesearch-open");
- });
-
- $(".mobile-menu-close").on("click", function (event) {
- event.preventDefault();
-
- if ($("body").hasClass("language-menu-open")) {
- $("body").removeClass("language-menu-open");
- } else {
- $("body").removeClass("mobilemenu-open");
- }
- });
-
- $(".language-menu-btn").on("click", function (event) {
- event.preventDefault();
- $("body").addClass("language-menu-open");
- });
-
- $(".comment-form-focus-input").focus(function () {
- var $el = $(this).hide();
- $(this)
- .closest(".comment-form")
- .find(".form_area")
- .show()
- .find("textarea")
- .focus();
- });
+ $(".mobile-menu-toggler").click(function (event) {
+ event.preventDefault();
+ $("body").toggleClass("mobilemenu-open");
+ $("body").removeClass("mobilesearch-open");
+ });
- if ($("body").hasClass("front-page")) {
- setFrontContent();
- $(".tbl").css("visibility", "visible");
- $(window).resize(debounce(setFrontContent, 100));
- }
+ $(".mobile-menu-close").on("click", function (event) {
+ event.preventDefault();
- if ($(".comment-form").hasClass("form_with_errors")) {
- $("html, body").scrollTop($(".comment-form").offset().top);
- } else if ($("form").find(".form_error, .form_notice").length > 0) {
- $("html, body").scrollTop(
- $(".form_error, .form_notice").closest("form").offset().top
- );
+ if ($("body").hasClass("language-menu-open")) {
+ $("body").removeClass("language-menu-open");
+ } else {
+ $("body").removeClass("mobilemenu-open");
}
+ });
+ $(".language-menu-btn").on("click", function (event) {
+ event.preventDefault();
+ $("body").addClass("language-menu-open");
});
- var editmode = function () {
- return $("html").hasClass("editmode");
- };
+ $(".comment-form-focus-input").focus(function () {
+ var $el = $(this).hide();
+ $(this)
+ .closest(".comment-form")
+ .find(".form_area")
+ .show()
+ .find("textarea")
+ .focus();
+ });
var setFrontContent = function () {
var wh = $(window).height(),
@@ -616,6 +596,20 @@ MMCQ = (function() {
$tbl.height(wh - 140);
};
+ if ($("body").hasClass("front-page")) {
+ setFrontContent();
+ $(".tbl").css("visibility", "visible");
+ $(window).resize(debounce(setFrontContent, 100));
+ }
+
+ if ($(".comment-form").hasClass("form_with_errors")) {
+ $("html, body").scrollTop($(".comment-form").offset().top);
+ } else if ($("form").find(".form_error, .form_notice").length > 0) {
+ $("html, body").scrollTop(
+ $(".form_error, .form_notice").closest("form").offset().top
+ );
+ }
+
$.fn.extend({
jsPopupMenu: function (options) {
this.each(function () {
@@ -722,7 +716,7 @@ MMCQ = (function() {
callback_loaded: callback_loaded
});
- $('.js-cart-btn').click(function() {
+ $('.js-cart-btn').click(function () {
if ($(this).data('product-id')) {
Voog.ShoppingCart.addProductById($(this).data('product-id'))
}
@@ -736,8 +730,8 @@ MMCQ = (function() {
});
};
- var handleWindowScroll = function() {
- window.addEventListener('scroll', function(e) {
+ var handleWindowScroll = function () {
+ window.addEventListener('scroll', function (e) {
var wrapperHeight = $('.header_fixed').height();
$('.t-sticky').css('top', $('.header_fixed').outerHeight() + 32);
@@ -751,22 +745,22 @@ MMCQ = (function() {
});
};
- var handleProductPageContent = function() {
- $(document).ready(function() {
+ var handleProductPageContent = function () {
+ $(document).ready(function () {
changeProductImagePos();
});
- $(window).resize(debounce(function() {
+ $(window).resize(debounce(function () {
changeProductImagePos();
}, 25));
- var changeProductImagePos = function() {
+ var changeProductImagePos = function () {
var paroductImage = $('.js-product-page-image');
var paroductImageWrap = $('.js-product-page-image-wrap');
var buyBtnContent = $('.js-buy-btn-content');
if ($('.js-buy-btn-content .edy-buy-button-container').length >= 1) {
- if ($( window ).width() <= 752) {
+ if ($(window).width() <= 752) {
if ($('.js-buy-btn-content .js-product-page-image').length <= 0) {
buyBtnContent.prepend(paroductImage);
}
@@ -779,7 +773,7 @@ MMCQ = (function() {
}
}
- var init = function() {
+ var init = function () {
handleWindowScroll();
};
@@ -788,4 +782,4 @@ MMCQ = (function() {
});
init();
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/javascripts/application.min.js b/javascripts/application.min.js
index 17fe114..d92211f 100644
--- a/javascripts/application.min.js
+++ b/javascripts/application.min.js
@@ -1 +1 @@
-var PriorityQueue=function(){function t(t){this.comparator=t,this.contents=[],this.sorted=!1}return t.prototype.sort=function(){return this.contents.sort(this.comparator),this.sotred=!0},t.prototype.push=function(t){return this.contents.push(t),this.sorted=!1},t.prototype.peek=function(t){return null==t&&(t=this.contents.length-1),this.sorted||this.sort(),this.contents[t]},t.prototype.pop=function(){return this.sorted||this.sort(),this.contents.pop()},t.prototype.size=function(){return this.contents.length},t.prototype.map=function(t){return this.contents.map(t)},t}(),MMCQ=function(){var f,i,a,I,h,l;function m(){this.maxIterations=1e3,this.fractByPopulations=.75}function t(t,e,o,n,r,i,s){this.r1=t,this.r2=e,this.g1=o,this.g2=n,this.b1=r,this.b2=i,this.histo=s}function e(){this.cboxes=new PriorityQueue(function(t,e){t=t.count()*t.volume(),e=e.count()*e.volume();return e>m.rshift,o=t[1]>>m.rshift,t=t[2]>>m.rshift;return this.r1<=e&&e<=this.r2&&this.g1<=o&&o<=this.g2&&this.b1<=t&&t<=this.b2},f=t,e.prototype.push=function(t){return this.cboxes.push({cbox:t,color:t.average()})},e.prototype.palette=function(){return this.cboxes.map(function(t){return t.color})},e.prototype.size=function(){return this.cboxes.size()},e.prototype.map=function(t){var e,o=e=0,n=this.cboxes.size();if(e>m.rshift,e=o[1]>>m.rshift,o=o[2]>>m.rshift,r[o=I(n,e,o)]=(r[o]||0)+1;return r},a=function(t,e){for(var o,n,r=1e6,i=0,s=1e6,u=0,c=1e6,a=0,h=0,l=t.length;h>m.rshift)>m.rshift)>m.rshift)g/2){for(e=f.copy(),o=f.copy(),r=(i=h-f[c])<=(s=f[a]-h)?Math.min(f[a]-1,~~(h+s/2)):Math.max(f[c],~~(h-1-i/2));!d[r];)r++;for(n=p[r];!n&&d[r-1];)n=p[--r];return e[a]=r,o[c]=e[a]+1,[e,o]}},s===c?n("r"):s===i?n("g"):s===o?n("b"):void 0}},m.prototype.quantize=function(t,e){var s,o,u,n,r,c=this;if(!t.length||e<2||256c.maxIterations)return void console.log("infinite loop; perhaps too few pixels")}else t.push(s),i++})(n,this.fractByPopulations*e),r=new PriorityQueue(function(t,e){t=t.count()*t.volume(),e=e.count()*e.volume();return e');var o=t.parent(),n=u(''),r=u(''),i=u('').text(t.children(":selected").text());r.append(i),o.append(r),o.append(n),t.hasClass("form_field_size_large")?(t.removeClass("form_field_size_large"),o.addClass("form_field_size_large")):t.hasClass("form_field_size_medium")?(t.removeClass("form_field_size_medium"),o.addClass("form_field_size_medium")):(t.hasClass("form_field_size_small")&&t.removeClass("form_field_size_small"),o.addClass("form_field_size_small")),t.change(u.proxy(function(){i.text(t.children(":selected").text())},this)),t.keyup(u.proxy(function(){i.text(t.children(":selected").text())},this)),t.bind("update",u.proxy(function(){i.text(t.children(":selected").text())},this))}},u.fn.extend({jqSelect:function(e){return this.each(function(){var t=u.extend({},e);u.jquerySelect.init(u(this),t)}),this}});new LazyLoad({threshold:500,elements_selector:".js-lazyload",callback_loaded:function(t){u(t).closest(".js-content-item-box").removeClass("not-loaded with-error").addClass("is-loaded")}});u(".js-cart-btn").click(function(){u(this).data("product-id")&&Voog.ShoppingCart.addProductById(u(this).data("product-id"))});window.site=u.extend(window.site||{},{handleProductPageContent:function(){u(document).ready(function(){t()}),u(window).resize(debounce(function(){t()},25));var t=function(){var t=u(".js-product-page-image"),e=u(".js-product-page-image-wrap"),o=u(".js-buy-btn-content");1<=u(".js-buy-btn-content .edy-buy-button-container").length&&(u(window).width()<=752?u(".js-buy-btn-content .js-product-page-image").length<=0&&o.prepend(t):u(".js-product-page-image-wrap .js-product-page-image").length<=0&&e.prepend(t))}}}),window.addEventListener("scroll",function(t){var e=u(".header_fixed").height();u(".t-sticky").css("top",u(".header_fixed").outerHeight()+32),window.scrollY>e?(u(".header_fixed:not(.relative)").addClass("scroll"),u("body").addClass("scroll")):(u(".header_fixed").removeClass("scroll"),u("body").removeClass("scroll"))})}(jQuery);
\ No newline at end of file
+var PriorityQueue=function(){function t(t){this.comparator=t,this.contents=[],this.sorted=!1}return t.prototype.sort=function(){return this.contents.sort(this.comparator),this.sotred=!0},t.prototype.push=function(t){return this.contents.push(t),this.sorted=!1},t.prototype.peek=function(t){return null==t&&(t=this.contents.length-1),this.sorted||this.sort(),this.contents[t]},t.prototype.pop=function(){return this.sorted||this.sort(),this.contents.pop()},t.prototype.size=function(){return this.contents.length},t.prototype.map=function(t){return this.contents.map(t)},t}(),MMCQ=function(){var f,i,a,I,h,l;function m(){this.maxIterations=1e3,this.fractByPopulations=.75}function t(t,e,o,n,r,i,s){this.r1=t,this.r2=e,this.g1=o,this.g2=n,this.b1=r,this.b2=i,this.histo=s}function e(){this.cboxes=new PriorityQueue(function(t,e){t=t.count()*t.volume(),e=e.count()*e.volume();return e>m.rshift,o=t[1]>>m.rshift,t=t[2]>>m.rshift;return this.r1<=e&&e<=this.r2&&this.g1<=o&&o<=this.g2&&this.b1<=t&&t<=this.b2},f=t,e.prototype.push=function(t){return this.cboxes.push({cbox:t,color:t.average()})},e.prototype.palette=function(){return this.cboxes.map(function(t){return t.color})},e.prototype.size=function(){return this.cboxes.size()},e.prototype.map=function(t){var e,o=e=0,n=this.cboxes.size();if(e>m.rshift,e=o[1]>>m.rshift,o=o[2]>>m.rshift,r[o=I(n,e,o)]=(r[o]||0)+1;return r},a=function(t,e){for(var o,n,r=1e6,i=0,s=1e6,u=0,c=1e6,a=0,h=0,l=t.length;h>m.rshift)>m.rshift)>m.rshift)g/2){for(e=f.copy(),o=f.copy(),r=(i=h-f[c])<=(s=f[a]-h)?Math.min(f[a]-1,~~(h+s/2)):Math.max(f[c],~~(h-1-i/2));!d[r];)r++;for(n=p[r];!n&&d[r-1];)n=p[--r];return e[a]=r,o[c]=e[a]+1,[e,o]}},s===c?n("r"):s===i?n("g"):s===o?n("b"):void 0}},m.prototype.quantize=function(t,e){var s,o,u,n,r,c=this;if(!t.length||e<2||256c.maxIterations)return void console.log("infinite loop; perhaps too few pixels")}else t.push(s),i++})(n,this.fractByPopulations*e),r=new PriorityQueue(function(t,e){t=t.count()*t.volume(),e=e.count()*e.volume();return e');var o=t.parent(),n=s(''),r=s(''),i=s('').text(t.children(":selected").text());r.append(i),o.append(r),o.append(n),t.hasClass("form_field_size_large")?(t.removeClass("form_field_size_large"),o.addClass("form_field_size_large")):t.hasClass("form_field_size_medium")?(t.removeClass("form_field_size_medium"),o.addClass("form_field_size_medium")):(t.hasClass("form_field_size_small")&&t.removeClass("form_field_size_small"),o.addClass("form_field_size_small")),t.change(s.proxy(function(){i.text(t.children(":selected").text())},this)),t.keyup(s.proxy(function(){i.text(t.children(":selected").text())},this)),t.bind("update",s.proxy(function(){i.text(t.children(":selected").text())},this))}},s.fn.extend({jqSelect:function(e){return this.each(function(){var t=s.extend({},e);s.jquerySelect.init(s(this),t)}),this}});new LazyLoad({threshold:500,elements_selector:".js-lazyload",callback_loaded:function(t){s(t).closest(".js-content-item-box").removeClass("not-loaded with-error").addClass("is-loaded")}});s(".js-cart-btn").click(function(){s(this).data("product-id")&&Voog.ShoppingCart.addProductById(s(this).data("product-id"))});window.site=s.extend(window.site||{},{handleProductPageContent:function(){s(document).ready(function(){t()}),s(window).resize(e(function(){t()},25));var t=function(){var t=s(".js-product-page-image"),e=s(".js-product-page-image-wrap"),o=s(".js-buy-btn-content");1<=s(".js-buy-btn-content .edy-buy-button-container").length&&(s(window).width()<=752?s(".js-buy-btn-content .js-product-page-image").length<=0&&o.prepend(t):s(".js-product-page-image-wrap .js-product-page-image").length<=0&&e.prepend(t))}}}),window.addEventListener("scroll",function(t){var e=s(".header_fixed").height();s(".t-sticky").css("top",s(".header_fixed").outerHeight()+32),window.scrollY>e?(s(".header_fixed:not(.relative)").addClass("scroll"),s("body").addClass("scroll")):(s(".header_fixed").removeClass("scroll"),s("body").removeClass("scroll"))})}(jQuery);
\ No newline at end of file
diff --git a/javascripts/editmode.js b/javascripts/editmode.js
index be270d6..d5072f4 100644
--- a/javascripts/editmode.js
+++ b/javascripts/editmode.js
@@ -1,52 +1,45 @@
(function ($) {
- $(function () {
- // Function to limit the rate at which a function can fire.
- var debounce = function (func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function () {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
+
+ // Function to limit the rate at which a function can fire.
+ var debounce = function (func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function () {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
};
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
};
+ };
- if ($("html").hasClass("no-placeholder")) {
- $('input[type="text"],textarea').each(function () {
- if ($(this).attr("placeholder") && !$(this).val()) {
- $(this).val($(this).attr("placeholder"));
- }
- $(this)
- .focus(function () {
- if ($(this).val() == $(this).attr("placeholder")) {
- $(this).val("");
- }
- })
- .blur(function () {
- if (!$(this).val() && $(this).attr("placeholder")) {
- $(this).val($(this).attr("placeholder"));
- }
- });
- });
- }
-
- $(".form_fields:not(.edy-fe-fields) select, .custom-select").jqSelect();
-
- $("body:not(.editmode) table").each(function () {
- $(this).wrap('');
+ if ($("html").hasClass("no-placeholder")) {
+ $('input[type="text"],textarea').each(function () {
+ if ($(this).attr("placeholder") && !$(this).val()) {
+ $(this).val($(this).attr("placeholder"));
+ }
+ $(this)
+ .focus(function () {
+ if ($(this).val() == $(this).attr("placeholder")) {
+ $(this).val("");
+ }
+ })
+ .blur(function () {
+ if (!$(this).val() && $(this).attr("placeholder")) {
+ $(this).val($(this).attr("placeholder"));
+ }
+ });
});
+ }
- if ($("body").hasClass("editmode")) {
- setTitlebox();
- $(window).resize(debounce(setTitlebox, 100));
- }
+ $(".form_fields:not(.edy-fe-fields) select, .custom-select").jqSelect();
+ $("body:not(.editmode) table").each(function () {
+ $(this).wrap('');
});
var setTitlebox = function () {
@@ -56,6 +49,70 @@
}
};
+ if ($("body").hasClass("editmode")) {
+ setTitlebox();
+ $(window).resize(debounce(setTitlebox, 100));
+ }
+
+ var initSettingsEditorBtn = function () {
+ window.addEventListener('DOMContentLoaded', function (event) {
+ var shadowDom = document.querySelector(".edy-next-shadowdom").shadowRoot;
+ var setSettingsBtn = setInterval(function () {
+ if (shadowDom.querySelectorAll('div[class^="toolbar__"]').length) {
+ var toolbarExpandBtn = shadowDom.querySelector('div[class^="toolbar-expand"]');
+ var toolbar = shadowDom.querySelector('div[class^="toolbar__"]');
+ var settingsBtn = document.querySelector(".js-layout_settings-btn");
+ var toolbarItem = shadowDom.querySelector('div[class^="toolbar-content-item__"]');
+
+ settingsBtn.className = toolbarItem.className + ' ' + settingsBtn.className;
+
+ toolbar.insertBefore(settingsBtn, toolbarExpandBtn);
+
+ shadowDom.querySelector(".js-layout_settings-btn").addEventListener(
+ "click",
+ function (e) {
+ if (document.querySelector('body').classList.contains('layout_settings-visible')) {
+ document.querySelector('div.editor_default').style.display = 'none';
+ }
+ document.querySelector('body').classList.toggle('layout_settings-visible');
+ e.stopImmediatePropagation();
+ }
+ );
+
+ var positionPopover = function () {
+ var settingsPopover = $('.js-layout_settings-popover');
+ var settingsPopoverArrow = $('.layout_settings-arrow');
+
+ if ($(window).width() > 768) {
+ settingsPopover.css({
+ right: window.innerWidth - settingsBtn.getBoundingClientRect().right - (settingsPopover.width() / 2)
+ });
+ settingsPopoverArrow.css({
+ right: settingsPopover.width() / 2
+ });
+ } else {
+ settingsPopover.css({
+ right: 0
+ });
+ settingsPopoverArrow.css({
+ right: 72
+ });
+ }
+ }
+
+ $(window).resize(debounce(function () {
+ positionPopover();
+ }, 25));
+
+ positionPopover();
+ clearInterval(setSettingsBtn);
+ }
+ }, 500);
+
+ $('body').append($('.js-layout_settings-popover'));
+ });
+ };
+
var toggleFlags = function () {
$(".js-option-toggle-flags").on("click", function (event) {
event.stopPropagation();
@@ -99,8 +156,7 @@
$imgDropAreaTarget
.removeClass('is-cropped')
.addClass('not-cropped')
- .css('opacity', .1)
- ;
+ .css('opacity', .1);
if (image) {
removeImagePlaceholder($contentItemBox, $cropToggleButton);
@@ -110,13 +166,11 @@
$contentItemBox
.removeClass('with-image is-loaded with-error')
- .addClass('without-image not-loaded')
- ;
+ .addClass('without-image not-loaded');
$cropToggleButton
.addClass('is-hidden')
- .removeClass('is-visible')
- ;
+ .removeClass('is-visible');
$contentItemBox.find('.edy-img-drop-area-placeholder').css('opacity', 0);
}
@@ -129,7 +183,10 @@
id: itemId
});
- itemData.set({ [cropStateKey]: 'not-cropped', [itemImageKey]: image });
+ itemData.set({
+ [cropStateKey]: 'not-cropped',
+ [itemImageKey]: image
+ });
$contentItemBox.removeClass('not-loaded with-error').addClass('is-loaded');
$contentItemBox.find('.edy-img-drop-area-placeholder').css('opacity', 1);
$imgDropAreaTarget.css('opacity', 1);
@@ -138,12 +195,12 @@
$removeBtn.on('click', function () {
var $el = $(this),
- itemId = $contentItemBox.data('item-id'),
- itemType = $contentItemBox.data('item-type'),
- itemData = new Edicy.CustomData({
- type: itemType,
- id: itemId
- });
+ itemId = $contentItemBox.data('item-id'),
+ itemType = $contentItemBox.data('item-type'),
+ itemData = new Edicy.CustomData({
+ type: itemType,
+ id: itemId
+ });
itemData.get({
success: function (data) {
@@ -167,7 +224,9 @@
contentType: 'application/json',
url: '/admin/api/pages/' + itemId,
dataType: 'json',
- data: JSON.stringify({ "image_id": null })
+ data: JSON.stringify({
+ "image_id": null
+ })
}).then(function (product) {
addProductImagePlaceholder($el, placeholderText);
});
@@ -184,13 +243,11 @@
$contentItemBox
.removeClass('without-image is-loaded with-error')
- .addClass('with-image not-loaded')
- ;
+ .addClass('with-image not-loaded');
$cropToggleButton
.removeClass('is-hidden')
- .addClass('is-visible')
- ;
+ .addClass('is-visible');
}
var addProductImagePlaceholder = function (el, placeholderText) {
@@ -201,8 +258,7 @@
itemBox.find('.top-inner').attr("style", "");
itemBox
.removeClass('with-image is-loaded with-error')
- .addClass('without-image not-loaded')
- ;
+ .addClass('without-image not-loaded');
itemBox.find('.edy-img-drop-area').removeClass('active');
itemBox.find('.image_settings').hide();
@@ -231,15 +287,13 @@
if ($imgDropAreaTarget.hasClass('is-cropped')) {
$imgDropAreaTarget
.removeClass('is-cropped')
- .addClass('not-cropped')
- ;
+ .addClass('not-cropped');
imageCropState = 'not-cropped';
} else {
$imgDropAreaTarget
.removeClass('not-cropped')
- .addClass('is-cropped')
- ;
+ .addClass('is-cropped');
imageCropState = 'is-cropped';
}
@@ -275,9 +329,13 @@
});
}
- entityData.set({ [dataKey]: val }, {
+ entityData.set({
+ [dataKey]: val
+ }, {
success: function () {
- if (dataReload) { location.reload(); };
+ if (dataReload) {
+ location.reload();
+ };
}
});
});
@@ -287,24 +345,22 @@
// ===========================================================================
// Toggles product categories visibility in main menu.
// ===========================================================================
- var bindRootItemSettings = function(rootItemValuesObj) {
+ var bindRootItemSettings = function (rootItemValuesObj) {
if (!('show_product_related_pages_in_main_menu' in rootItemValuesObj)) {
rootItemValuesObj.show_product_related_pages_in_main_menu = false;
}
- $('.js-root-item-settings-toggle').each(function(index, languageMenuSettingsButton) {
+ $('.js-root-item-settings-toggle').each(function (index, languageMenuSettingsButton) {
var rootItemSettingsEditor = new Edicy.SettingsEditor(languageMenuSettingsButton, {
- menuItems: [
- {
- "titleI18n": "show_in_main_menu",
- "type": "checkbox",
- "key": "show_product_related_pages_in_main_menu",
- "states": {
- "on": true,
- "off": false
- }
+ menuItems: [{
+ "titleI18n": "show_in_main_menu",
+ "type": "checkbox",
+ "key": "show_product_related_pages_in_main_menu",
+ "states": {
+ "on": true,
+ "off": false
}
- ],
+ }],
buttonTitleI18n: "settings",
@@ -312,7 +368,7 @@
containerClass: ['js-root-item-settings-popover', 'js-prevent-sideclick'],
- preview: function(data) {
+ preview: function (data) {
if (!data.show_product_related_pages_in_main_menu === true) {
$('.js-menu-item-products').addClass('is-hidden');
} else {
@@ -320,7 +376,7 @@
}
},
- commit: function(data) {
+ commit: function (data) {
siteData.set('settings_root_item', data);
}
});
@@ -342,7 +398,7 @@
};
var frontPageContentBgImageSizesContains = function (sizes, url) {
- for (var i = sizes.length; i--; ) {
+ for (var i = sizes.length; i--;) {
if (url.indexOf(sizes[i].url.trim()) > -1) {
return true;
}
@@ -370,23 +426,23 @@
var frontPageContentBgImagePrevious = $(".js-bgpicker-cover-image").css(
"background-image"
),
- frontPageContentBgImageSuitable = data.imageSizes
- ? getImageByWidth(data.imageSizes, $(window).width())
- : null,
+ frontPageContentBgImageSuitable = data.imageSizes ?
+ getImageByWidth(data.imageSizes, $(window).width()) :
+ null,
frontPageContentBgImage =
- data.image && data.image !== ""
- ? "url(" + frontPageContentBgImageSuitable.url + ")"
- : "none",
+ data.image && data.image !== "" ?
+ "url(" + frontPageContentBgImageSuitable.url + ")" :
+ "none",
frontPageContentBgImageSizes =
- data.imageSizes && data.imageSizes !== "" ? data.imageSizes : null,
+ data.imageSizes && data.imageSizes !== "" ? data.imageSizes : null,
frontPageContentBgColor =
- data.color && data.color !== "" ? data.color : "rgba(0,0,0,0)",
+ data.color && data.color !== "" ? data.color : "rgba(0,0,0,0)",
frontPageContentBgColorDataLightness =
- data.colorData && data.colorData !== "" ? data.colorData.lightness : 1,
+ data.colorData && data.colorData !== "" ? data.colorData.lightness : 1,
colorExtractImage = $(""),
colorExtractCanvas = $("