Skip to content

Commit 0be91a5

Browse files
committed
Merge pull request #14 from magento-vanilla/PR
[Vanilla] Bug Fixes
2 parents 9b1f7f5 + d11c7ab commit 0be91a5

File tree

14 files changed

+169
-74
lines changed

14 files changed

+169
-74
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
click: function () {
467467
(function ($) {
468468
$.ajax({
469-
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//',
469+
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>',
470470
method: 'POST',
471471
data: pd.join(""),
472472
showLoader: true

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,5 @@ define([
761761
}
762762
};
763763

764-
jQuery(document).ready(function(){
765-
productConfigure = new ProductConfigure();
766-
});
767-
764+
productConfigure = new ProductConfigure();
768765
});

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
newAttributeSetContainer = $('[data-role=affected-attribute-set-new-name-container]'),
3434
existingAttributeSetContainer = $('[data-role=affected-attribute-set-existing-name-container]');
3535

36+
$form.find('input[type=text]').on('keypress',function(e){
37+
if(e.keyCode === 13){
38+
e.preventDefault();
39+
$form.closest('[data-role=modal]').find('button[data-action=confirm]').click();
40+
}
41+
});
3642

3743
$('[data-form=edit-product]').append($('<input>', {
3844
type: 'hidden',
@@ -48,6 +54,9 @@
4854
},
4955
buttons: [{
5056
text: '<?php /* @escapeNotVerified */ echo __('Confirm'); ?>',
57+
attr: {
58+
'data-action': 'confirm'
59+
},
5160
'class': 'action-secondary',
5261
click: function() {
5362
var affectedAttributeSetId = $form.find('input[name=affected-attribute-set]:checked').val();

app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,34 @@
2121
"use strict";
2222

2323
$.each({
24+
'validate-card-type': [
25+
function (number, item, allowedTypes) {
26+
var cardInfo,
27+
i,
28+
l;
29+
30+
if (!creditCardNumberValidator(number).isValid) {
31+
return false;
32+
} else {
33+
cardInfo = creditCardNumberValidator(number).card;
34+
35+
for (i = 0, l = allowedTypes.length; i < l; i++) {
36+
if (cardInfo.title == allowedTypes[i].type) {
37+
return true;
38+
}
39+
}
40+
return false;
41+
}
42+
},
43+
'Please enter a valid credit card type number.'
44+
],
2445
'validate-card-number': [
2546
/**
2647
* Validate credit card number based on mod 10
2748
* @param number - credit card number
2849
* @return {boolean}
2950
*/
30-
function (number) {
51+
function (number) {
3152
return creditCardNumberValidator(number).isValid;
3253
},
3354
'Please enter a valid credit card number.'

app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
id: getCode() + '_cc_number',
5151
title: $t('Credit Card Number'),
5252
'data-container': getCode() + '-cc-number',
53-
'data-validate': JSON.stringify({'required-number':true, 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
53+
'data-validate': JSON.stringify({'required-number':true, 'validate-card-type':getCcAvailableTypesValues(), 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
5454
enable: isActive($parents),
5555
value: creditCardNumber,
5656
valueUpdate: 'keyup' "/>

app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,54 @@
44
*/
55
define([
66
'jquery',
7+
'productGallery',
78
'jquery/ui',
89
'Magento_Ui/js/modal/modal',
910
'mage/translate',
1011
'mage/backend/tree-suggest',
1112
'mage/backend/validation'
12-
], function ($) {
13+
], function ($, productGallery) {
1314
'use strict';
1415

15-
$.widget('mage.productGallery',
16-
$.mage.productGallery,
17-
{
18-
19-
/**
20-
* Fired when windget initialization start
21-
* @private
22-
*/
23-
_create: function () {
24-
this._bind();
25-
},
26-
27-
/**
28-
* Bind events
29-
* @private
30-
*/
31-
_bind: function () {
32-
$(this.element).on('click', this.showModal.bind(this));
33-
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
34-
},
35-
36-
/**
37-
* Open dialog for external video
38-
* @private
39-
*/
40-
_onOpenDialog: function (e, imageData) {
41-
42-
if (imageData['media_type'] !== 'external-video') {
43-
return;
44-
}
45-
this.showModal();
46-
},
47-
48-
/**
49-
* Fired on trigger "openModal"
50-
*/
51-
showModal: function () {
52-
53-
$('#new-video').modal('openModal');
16+
$.widget('mage.productGallery', productGallery, {
17+
18+
/**
19+
* * Fired when widget initialization start
20+
* @private
21+
*/
22+
_create: function () {
23+
this._bind();
24+
},
25+
26+
/**
27+
* Bind events
28+
* @private
29+
*/
30+
_bind: function () {
31+
$(this.element).on('click', this.showModal.bind(this));
32+
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
33+
},
34+
35+
/**
36+
* Open dialog for external video
37+
* @private
38+
*/
39+
_onOpenDialog: function (e, imageData) {
40+
41+
if (imageData['media_type'] !== 'external-video') {
42+
return;
5443
}
44+
this.showModal();
45+
},
46+
47+
/**
48+
* Fired on trigger "openModal"
49+
*/
50+
showModal: function () {
51+
52+
$('#new-video').modal('openModal');
5553
}
56-
);
54+
});
5755

5856
return $.mage.productGallery;
5957
});

app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
*/
77
-->
88
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
9-
<head>
10-
<link src="Magento_ProductVideo::js/fotorama-add-video-events.js"/>
11-
<link src="Magento_ProductVideo::js/load-player.js"/>
12-
</head>
139
<body>
1410
<referenceContainer name="product.info.media">
1511
<block class="Magento\ProductVideo\Block\Product\View\Gallery" name="product.info.media.video" after="product.info.media.image" template="product/view/gallery.phtml"/>

app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,29 @@ define([
6464
}, 10);
6565
};
6666

67-
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
68-
proceed();
69-
this._parent.itemsArea.setNode($(this._parent.getAreaId('items')));
70-
this._parent.itemsArea.onLoad();
71-
});
67+
if (jQuery('#' + this.getAreaId('items')).is(':visible')) {
68+
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
69+
proceed();
70+
this._parent.itemsArea.setNode($(this._parent.getAreaId('items')));
71+
this._parent.itemsArea.onLoad();
72+
});
7273

73-
this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) {
74-
proceed();
75-
if ($(searchAreaId) && !$(searchAreaId).visible()) {
76-
this.addControlButton(searchButton);
77-
}
78-
});
79-
this.areasLoaded();
80-
this.itemsArea.onLoad();
74+
this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) {
75+
proceed();
76+
if ($(searchAreaId) && !$(searchAreaId).visible()) {
77+
this.addControlButton(searchButton);
78+
}
79+
});
80+
this.areasLoaded();
81+
this.itemsArea.onLoad();
82+
}
8183
}).bind(this));
8284

8385
jQuery('#edit_form')
8486
.on('submitOrder', function(){
8587
jQuery(this).trigger('realOrder');
8688
})
8789
.on('realOrder', this._realSubmit.bind(this));
88-
8990
},
9091

9192
areasLoaded: function(){

app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ define([
7373
$.async(this.stickyContainerSelector,
7474
this,
7575
this.initContainerNode);
76-
$.async(this.stickyElementSelector,
77-
this.listing(),
78-
this.initStickyListingNode);
79-
$.async(this.stickyElementSelector,
80-
this.toolbar(),
81-
this.initStickyToolbarNode);
8276

8377
return this;
8478
},
@@ -154,6 +148,13 @@ define([
154148
$.async(this.rightDataGridCapSelector,
155149
node,
156150
this.initRightDataGridCap);
151+
152+
$.async(this.stickyElementSelector,
153+
this.listing(),
154+
this.initStickyListingNode);
155+
$.async(this.stickyElementSelector,
156+
this.toolbar(),
157+
this.initStickyToolbarNode);
157158
},
158159

159160
/**

app/code/Magento/Ui/view/base/web/js/lib/core/storage.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,72 @@ define([
1111
'use strict';
1212

1313
var root = 'appData',
14+
localStorage = window.localStorage,
15+
hasSupport,
1416
storage;
1517

18+
/**
19+
* Flag which indicates whether localStorage is supported.
20+
*/
21+
hasSupport = (function () {
22+
var key = '_storageSupported';
23+
24+
try {
25+
localStorage.setItem(key, 'true');
26+
27+
if (localStorage.getItem(key) === 'true') {
28+
localStorage.removeItem(key);
29+
30+
return true;
31+
}
32+
33+
return false;
34+
} catch (e) {
35+
return false;
36+
}
37+
})();
38+
39+
if (!hasSupport) {
40+
localStorage = {
41+
_data: {},
42+
43+
/**
44+
* Sets value of the specified item.
45+
*
46+
* @param {String} key - Key of the property.
47+
* @param {*} value - Properties' value.
48+
*/
49+
setItem: function (key, value) {
50+
this._data[key] = value + '';
51+
},
52+
53+
/**
54+
* Retrieves specfied item.
55+
*
56+
* @param {String} key - Key of the property to be retrieved.
57+
*/
58+
getItem: function (key) {
59+
return this._data[key];
60+
},
61+
62+
/**
63+
* Removes specfied item.
64+
*
65+
* @param {String} key - Key of the property to be removed.
66+
*/
67+
removeItem: function (key) {
68+
delete this._data[key];
69+
},
70+
71+
/**
72+
* Removes all items.
73+
*/
74+
clear: function () {
75+
this._data = {};
76+
}
77+
};
78+
}
79+
1680
/**
1781
* Extracts and parses data stored in localStorage by the
1882
* key specified in 'root' varaible.

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ define([
2222
*/
2323
var transitionEvent = (function () {
2424
var transition,
25-
elementStyle = document.body.style,
25+
elementStyle = document.createElement('div').style,
2626
transitions = {
2727
'transition': 'transitionend',
2828
'OTransition': 'oTransitionEnd',

dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"disallowTrailingComma": true,
7676
"disallowTrailingWhitespace": true,
7777
"disallowYodaConditions": true,
78+
"maxErrors": null,
7879
"requireBlocksOnNewline": true,
7980
"requireDotNotation": "except_snake_case",
8081
"requireCamelCaseOrUpperCaseIdentifiers": true,

lib/web/fotorama/fotorama.min.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/mage/validation/url.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ define([], function () {
3535
path.indexOf('vbscript:') !== -1) {
3636
return false;
3737
}
38+
39+
return true;
3840
},
3941

4042
/**
@@ -44,7 +46,7 @@ define([], function () {
4446
* @returns {String}
4547
*/
4648
sanitize: function (path) {
47-
return path.Replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', '');
49+
return path.replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', '');
4850
}
4951
};
5052
});

0 commit comments

Comments
 (0)