Skip to content

Commit ae614cc

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-182
2 parents 7a0516a + 363ba43 commit ae614cc

File tree

90 files changed

+21918
-17504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+21918
-17504
lines changed

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22
/**
3-
* Default application path for backend area
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
86
namespace Magento\Backend\App;
97

108
/**
9+
* Default application path for backend area
10+
*
1111
* @api
1212
* @since 100.0.2
1313
*/
@@ -24,7 +24,11 @@ class DefaultPath implements \Magento\Framework\App\DefaultPathInterface
2424
*/
2525
public function __construct(\Magento\Backend\App\ConfigInterface $config)
2626
{
27-
$pathParts = explode('/', $config->getValue('web/default/admin'));
27+
$pathConfigValue = $config->getValue('web/default/admin') ?? '';
28+
$pathParts = [];
29+
if ($pathConfigValue) {
30+
$pathParts = explode('/', $pathConfigValue);
31+
}
2832

2933
$this->_parts = [
3034
'area' => isset($pathParts[0]) ? $pathParts[0] : '',

app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use Magento\Framework\View\Helper\SecureHtmlRenderer;
1919
<?php foreach ($tabs as $_tab): ?>
2020
<?php $tabId = $block->getTabId($_tab) ?>
2121
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
22-
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
22+
($_tab->getClass() !== null ? (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') : '') ?>
2323
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
2424
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
2525
'#' . $tabId . '_content' :

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
2222
<attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/>
2323
<comment userInput="BIC workaround" stepKey="waitForAjaxUpload"/>
24-
<waitForPageLoad stepKey="waitForLoading"/>
24+
<waitForElementVisible selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="waitForLoading"/>
2525
<grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/>
2626
<assertRegExp stepKey="assertEquals" message="pass">
2727
<expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult>

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ define([
1616
url: '',
1717
data: [],
1818
tree: {
19-
plugins: ['themes', 'json_data', 'ui', 'hotkeys'],
20-
themes: {
21-
theme: 'default',
22-
dots: false,
23-
icons: true
19+
core: {
20+
themes: {
21+
dots: false
22+
}
2423
}
2524
}
2625
},
@@ -33,27 +32,8 @@ define([
3332
{},
3433
options.tree,
3534
{
36-
'json_data': {
37-
ajax: {
38-
url: options.url,
39-
type: 'POST',
40-
success: $.proxy(function (nodes) {
41-
return this._convertDataNodes(nodes);
42-
}, this),
43-
44-
/**
45-
* @param {HTMLElement} node
46-
* @return {Object}
47-
*/
48-
data: function (node) {
49-
return {
50-
id: $(node).data('id'),
51-
'form_key': window.FORM_KEY
52-
};
53-
}
54-
},
55-
data: this._convertData(options.data).children,
56-
'progressive_render': true
35+
core: {
36+
data: this._convertData(this.options.data).children
5737
}
5838
}
5939
);
@@ -68,9 +48,9 @@ define([
6848
* @private
6949
*/
7050
_selectNode: function (event, data) {
71-
var node = data.rslt.obj.data();
51+
var node = data.node;
7252

73-
if (!node.disabled) {
53+
if (!node.state.disabled) {
7454
window.location = window.location + '/' + node.id;
7555
} else {
7656
event.preventDefault();
@@ -85,7 +65,7 @@ define([
8565
_convertDataNodes: function (nodes) {
8666
var nodesData = [];
8767

88-
nodes.forEach(function (node) {
68+
nodes.children.forEach(function (node) {
8969
nodesData.push(this._convertData(node));
9070
}, this);
9171

@@ -104,25 +84,19 @@ define([
10484
if (!node) {
10585
return result;
10686
}
87+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
10788
result = {
108-
data: {
109-
title: utils.unescape(node.name) + ' (' + node['product_count'] + ')'
89+
id: node.id,
90+
text: utils.unescape(node.name) + ' (' + node.product_count + ')',
91+
li_attr: {
92+
class: node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
11093
},
111-
attr: {
112-
'class': node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
113-
},
114-
metadata: {
115-
id: node.id,
116-
disabled: node.disabled
94+
state: {
95+
disabled: node.disabled,
96+
opened: !!node.children_count && node.expanded
11797
}
11898
};
119-
120-
if (node['children_count'] && !node.expanded) {
121-
result.state = 'closed';
122-
} else {
123-
result.state = 'open';
124-
}
125-
99+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
126100
if (node.children) {
127101
result.children = [];
128102
$.each(node.children, function () {

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37-
$(this.options.addToCartButtonSelector).attr('disabled', false);
37+
$(this.options.addToCartButtonSelector).prop('disabled', false);
3838
},
3939

4040
/**
@@ -101,7 +101,7 @@ define([
101101
formData = new FormData(form[0]);
102102

103103
$.ajax({
104-
url: form.attr('action'),
104+
url: form.prop('action'),
105105
data: formData,
106106
type: 'post',
107107
dataType: 'json',
@@ -201,7 +201,7 @@ define([
201201

202202
addToCartButton.addClass(this.options.addToCartButtonDisabledClass);
203203
addToCartButton.find('span').text(addToCartButtonTextWhileAdding);
204-
addToCartButton.attr('title', addToCartButtonTextWhileAdding);
204+
addToCartButton.prop('title', addToCartButtonTextWhileAdding);
205205
},
206206

207207
/**
@@ -213,14 +213,14 @@ define([
213213
addToCartButton = $(form).find(this.options.addToCartButtonSelector);
214214

215215
addToCartButton.find('span').text(addToCartButtonTextAdded);
216-
addToCartButton.attr('title', addToCartButtonTextAdded);
216+
addToCartButton.prop('title', addToCartButtonTextAdded);
217217

218218
setTimeout(function () {
219219
var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Cart');
220220

221221
addToCartButton.removeClass(self.options.addToCartButtonDisabledClass);
222222
addToCartButton.find('span').text(addToCartButtonTextDefault);
223-
addToCartButton.attr('title', addToCartButtonTextDefault);
223+
addToCartButton.prop('title', addToCartButtonTextDefault);
224224
}, 1000);
225225
}
226226
});

app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
class Tree extends \Magento\Backend\Block\Template
1515
{
1616
/**
17-
* Core registry
18-
*
1917
* @var \Magento\Framework\Registry
2018
*/
2119
protected $_coreRegistry = null;
2220

2321
/**
24-
* Cms wysiwyg images
25-
*
2622
* @var \Magento\Cms\Helper\Wysiwyg\Images
2723
*/
2824
protected $_cmsWysiwygImages = null;
@@ -78,9 +74,9 @@ public function getTreeJson()
7874
];
7975
$hasNestedDirectories = $this->hasNestedDirectories($storageRoot, $item->getFilename());
8076

81-
// if no nested directories inside dir, add 'leaf' state so that jstree hides dropdown arrow next to dir
82-
if (!$hasNestedDirectories) {
83-
$data['state'] = 'leaf';
77+
// Display node as closed and enable lazy loading
78+
if ($hasNestedDirectories) {
79+
$data['children'] = true;
8480
}
8581

8682
$jsonArray[] = $data;

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/MediaGallerySection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<element name="confirmDelete" type="button" selector=".action-primary.action-accept"/>
3838
<element name="imageBlockByName" type="block" selector="//div[@data-row='file'][contains(., '{{imageName}}')]" parameterized="true"/>
3939
<element name="insertEditImageModalWindow" type="block" selector=".mce-floatpanel.mce-window[aria-label='Insert/edit image']"/>
40-
<element name="mediaGalleryFolderTreeIconCollapsed" type="button" parameterized="true" selector="//a[text()='{{folderName}}']/parent::li[contains(@class,'jstree-closed')]/ins"/>
41-
<element name="mediaGalleryFolderTreeIconExpanded" type="button" parameterized="true" selector="//a[text()='{{folderName}}']/parent::li[contains(@class,'jstree-open')]/ins"/>
40+
<element name="mediaGalleryFolderTreeIconCollapsed" type="button" parameterized="true" selector="//li[a[text()='{{folderName}}' and @aria-expanded='false']]/i"/>
41+
<element name="mediaGalleryFolderTreeIconExpanded" type="button" parameterized="true" selector="//li[a[text()='{{folderName}}' and @aria-expanded='true']]/i"/>
4242
</section>
4343
</sections>

app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ define([
1717
url: '',
1818
currentPath: ['root'],
1919
tree: {
20-
'plugins': ['themes', 'json_data', 'ui', 'hotkeys'],
21-
'themes': {
22-
'theme': 'default',
23-
'dots': false,
24-
'icons': true
20+
core: {
21+
themes: {
22+
dots: false
23+
},
24+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
25+
check_callback: true
26+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
2527
}
2628
}
2729
},
@@ -34,41 +36,33 @@ define([
3436
{},
3537
options.tree,
3638
{
37-
'json_data': {
39+
core: {
3840
data: {
39-
data: options.rootName,
40-
state: 'closed',
41-
metadata: {
42-
node: {
43-
id: options.root,
44-
text: options.rootName
45-
}
46-
},
47-
attr: {
48-
'data-id': options.root,
49-
id: options.root
50-
}
51-
},
52-
ajax: {
5341
url: options.url,
42+
type: 'POST',
43+
dataType: 'text',
44+
dataFilter: $.proxy(function (data) {
45+
return this._convertData(JSON.parse(data));
46+
}, this),
5447

5548
/**
56-
* @param {Object} node
49+
* @param {HTMLElement} node
5750
* @return {Object}
5851
*/
5952
data: function (node) {
6053
return {
61-
node: node.data('id'),
54+
node: node.id === 'root' ? null : node.id,
6255
'form_key': window.FORM_KEY
6356
};
64-
},
65-
success: this._convertData
57+
}
6658
}
6759
}
6860
}
6961
);
7062

71-
this.element.jstree(treeOptions).on('loaded.jstree', $.proxy(this.treeLoaded, this));
63+
this.element.jstree(treeOptions)
64+
.on('ready.jstree', $.proxy(this.treeLoaded, this))
65+
.on('load_node.jstree', $.proxy(this._createRootNode, this));
7266
},
7367

7468
/**
@@ -106,25 +100,52 @@ define([
106100
recursiveOpen();
107101
},
108102

103+
/**
104+
* Create tree root node
105+
*
106+
* @param {jQuery.Event} event
107+
* @param {Object} data
108+
* @private
109+
*/
110+
_createRootNode: function (event, data) {
111+
var rootNode, children;
112+
113+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
114+
if (data.node.id === '#') {
115+
rootNode = {
116+
id: this.options.root,
117+
text: this.options.rootName,
118+
li_attr: {
119+
'data-id': this.options.root
120+
}
121+
};
122+
children = data.node.children;
123+
124+
data.instance.element.jstree().create_node(null, rootNode, 'first', function () {
125+
data.instance.element.jstree().move_node(children, rootNode.id);
126+
});
127+
}
128+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
129+
},
130+
109131
/**
110132
* @param {*} data
111133
* @return {*}
112134
* @private
113135
*/
114136
_convertData: function (data) {
115137
return $.map(data, function (node) {
116-
var codeCopy = $.extend({}, node);
117138

118139
return {
119-
data: node.text,
120-
attr: {
121-
'data-id': node.id,
122-
id: node.id
123-
},
124-
metadata: {
125-
node: codeCopy
140+
id: node.id,
141+
text: node.text,
142+
path: node.path,
143+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
144+
li_attr: {
145+
'data-id': node.id
126146
},
127-
state: node.state || 'closed'
147+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
148+
children: node.children
128149
};
129150
});
130151
}

0 commit comments

Comments
 (0)