Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove errors on empty preview

Pacu23c3fb5b7c74c
diff --git a/saleor/static/dashboard/js/components/google-preview.js b/saleor/static/dashboard/js/components/google-preview.js
index b7fede63df..3cecc528d9 100644
--- a/saleor/static/dashboard/js/components/google-preview.js
+++ b/saleor/static/dashboard/js/components/google-preview.js
@@ -10,7 +10,7 @@ let $description = '';
const $descriptionId = $seoDescription.data('bind');
if ($descriptionMaterialize) {
const $descriptions = $(`.materialize-textarea[name='${$descriptionMaterialize}']`);
- // They're two textareas from Medium editor, one contains HTML-free text, other formating
+ // They're two textareas from Medium editor, first one contains HTML-free text
$description = $descriptions.not($descriptionId).first();
} else {
if ($descriptionId) {
@@ -21,7 +21,6 @@ if ($descriptionMaterialize) {
const $googleTitlePreview = $('#google-preview-title');
const $googleDescriptionPreview = $('#google-preview-description');
const $preview = $('#google-preview');
-const $previewErrors = $('#preview-error');
const watchedEvents = 'input propertychange cut paste copy change';
@@ -58,19 +57,8 @@ function checkForErrors() {
const $titleText = $googleTitlePreview.text();
if ($descriptionText && $titleText) {
$preview.show();
- $previewErrors.hide();
- } else if (!$descriptionText && !$titleText) {
- $preview.hide();
- $previewErrors.text(gettext('Please provide SEO Title and Meta Description to see how this product might appear in search engine results.'));
- $previewErrors.show();
- } else if (!$descriptionText) {
- $preview.hide();
- $previewErrors.text(gettext('Please provide Meta Description to see how this product might appear in search engine results.'));
- $previewErrors.show();
- } else if (!$titleText) {
+ } else {
$preview.hide();
- $previewErrors.text(gettext('Please provide SEO Title to see how this product might appear in search engine results.'));
- $previewErrors.show();
}
}
diff --git a/templates/dashboard/includes/_google_preview.html b/templates/dashboard/includes/_google_preview.html
index 095afacdef..daf0823083 100644
--- a/templates/dashboard/includes/_google_preview.html
+++ b/templates/dashboard/includes/_google_preview.html
@@ -5,7 +5,6 @@
<span class="card-title">{% trans "Search engine listing preview" context "Title of the box showing preview from the search engine perspective" %}</span>
<div class='google-preview__container'>
<br>
- <div id="preview-error"></div>
<div id="google-preview">
<div class='google-preview__title'>
<a id="google-preview-title" href='#'>{{ object.seo_title|default:"" }}</a>