-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2739 from magento-tsg/2.2-develop-pr31
[TSG] Backporting for 2.2 (pr31) (2.2.6)
- Loading branch information
Showing
40 changed files
with
1,228 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/code/Magento/Catalog/view/frontend/web/js/product/remaining-characters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
define([ | ||
'jquery', | ||
'mage/translate', | ||
'jquery/ui' | ||
], function ($, $t) { | ||
'use strict'; | ||
|
||
$.widget('mage.remainingCharacters', { | ||
options: { | ||
remainingText: $t('remaining'), | ||
tooManyText: $t('too many'), | ||
errorClass: 'mage-error', | ||
noDisplayClass: 'no-display' | ||
}, | ||
|
||
/** | ||
* Initializes custom option component | ||
* | ||
* @private | ||
*/ | ||
_create: function () { | ||
this.note = $(this.options.noteSelector); | ||
this.counter = $(this.options.counterSelector); | ||
|
||
this.updateCharacterCount(); | ||
this.element.on('change keyup paste', this.updateCharacterCount.bind(this)); | ||
}, | ||
|
||
/** | ||
* Updates counter message | ||
*/ | ||
updateCharacterCount: function () { | ||
var length = this.element.val().length, | ||
diff = this.options.maxLength - length; | ||
|
||
this.counter.text(this._formatMessage(diff)); | ||
this.counter.toggleClass(this.options.noDisplayClass, length === 0); | ||
this.note.toggleClass(this.options.errorClass, diff < 0); | ||
}, | ||
|
||
/** | ||
* Format remaining characters message | ||
* | ||
* @param {int} diff | ||
* @returns {String} | ||
* @private | ||
*/ | ||
_formatMessage: function (diff) { | ||
var count = Math.abs(diff), | ||
qualifier = diff < 0 ? this.options.tooManyText : this.options.remainingText; | ||
|
||
return '(' + count + ' ' + qualifier + ')'; | ||
} | ||
}); | ||
|
||
return $.mage.remainingCharacters; | ||
}); |
45 changes: 45 additions & 0 deletions
45
app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Model/Plugin/Category.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Category as Resource; | ||
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor; | ||
|
||
/** | ||
* Perform indexer invalidation after a category delete. | ||
*/ | ||
class Category | ||
{ | ||
/** | ||
* @var Processor | ||
*/ | ||
private $fulltextIndexerProcessor; | ||
|
||
/** | ||
* @param Processor $fulltextIndexerProcessor | ||
*/ | ||
public function __construct(Processor $fulltextIndexerProcessor) | ||
{ | ||
$this->fulltextIndexerProcessor = $fulltextIndexerProcessor; | ||
} | ||
|
||
/** | ||
* Mark fulltext indexer as invalid post-deletion of category. | ||
* | ||
* @param Resource $subjectCategory | ||
* @param Resource $resultCategory | ||
* @return Resource | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function afterDelete(Resource $subjectCategory, Resource $resultCategory): Resource | ||
{ | ||
$this->fulltextIndexerProcessor->markIndexerAsInvalid(); | ||
|
||
return $resultCategory; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Catalog\Model\ResourceModel\Category"> | ||
<plugin name="fulltext_search_indexer" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin\Category"/> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Catalog\Model\ResourceModel\Category"> | ||
<plugin name="fulltext_search_indexer" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin\Category"/> | ||
</type> | ||
</config> |
Oops, something went wrong.