Skip to content

Commit

Permalink
Merge pull request #14 from magento-vanilla/PR
Browse files Browse the repository at this point in the history
[Vanilla] Bug Fixes
  • Loading branch information
guz-anton committed Oct 21, 2015
2 parents 9b1f7f5 + d11c7ab commit 0be91a5
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
click: function () {
(function ($) {
$.ajax({
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//',
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>',
method: 'POST',
data: pd.join(""),
showLoader: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,5 @@ define([
}
};

jQuery(document).ready(function(){
productConfigure = new ProductConfigure();
});

productConfigure = new ProductConfigure();
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
newAttributeSetContainer = $('[data-role=affected-attribute-set-new-name-container]'),
existingAttributeSetContainer = $('[data-role=affected-attribute-set-existing-name-container]');

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

$('[data-form=edit-product]').append($('<input>', {
type: 'hidden',
Expand All @@ -48,6 +54,9 @@
},
buttons: [{
text: '<?php /* @escapeNotVerified */ echo __('Confirm'); ?>',
attr: {
'data-action': 'confirm'
},
'class': 'action-secondary',
click: function() {
var affectedAttributeSetId = $form.find('input[name=affected-attribute-set]:checked').val();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,34 @@
"use strict";

$.each({
'validate-card-type': [
function (number, item, allowedTypes) {
var cardInfo,
i,
l;

if (!creditCardNumberValidator(number).isValid) {
return false;
} else {
cardInfo = creditCardNumberValidator(number).card;

for (i = 0, l = allowedTypes.length; i < l; i++) {
if (cardInfo.title == allowedTypes[i].type) {
return true;
}
}
return false;
}
},
'Please enter a valid credit card type number.'
],
'validate-card-number': [
/**
* Validate credit card number based on mod 10
* @param number - credit card number
* @return {boolean}
*/
function (number) {
function (number) {
return creditCardNumberValidator(number).isValid;
},
'Please enter a valid credit card number.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
id: getCode() + '_cc_number',
title: $t('Credit Card Number'),
'data-container': getCode() + '-cc-number',
'data-validate': JSON.stringify({'required-number':true, 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
'data-validate': JSON.stringify({'required-number':true, 'validate-card-type':getCcAvailableTypesValues(), 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})},
enable: isActive($parents),
value: creditCardNumber,
valueUpdate: 'keyup' "/>
Expand Down
80 changes: 39 additions & 41 deletions app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,54 @@
*/
define([
'jquery',
'productGallery',
'jquery/ui',
'Magento_Ui/js/modal/modal',
'mage/translate',
'mage/backend/tree-suggest',
'mage/backend/validation'
], function ($) {
], function ($, productGallery) {
'use strict';

$.widget('mage.productGallery',
$.mage.productGallery,
{

/**
* Fired when windget initialization start
* @private
*/
_create: function () {
this._bind();
},

/**
* Bind events
* @private
*/
_bind: function () {
$(this.element).on('click', this.showModal.bind(this));
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
},

/**
* Open dialog for external video
* @private
*/
_onOpenDialog: function (e, imageData) {

if (imageData['media_type'] !== 'external-video') {
return;
}
this.showModal();
},

/**
* Fired on trigger "openModal"
*/
showModal: function () {

$('#new-video').modal('openModal');
$.widget('mage.productGallery', productGallery, {

/**
* * Fired when widget initialization start
* @private
*/
_create: function () {
this._bind();
},

/**
* Bind events
* @private
*/
_bind: function () {
$(this.element).on('click', this.showModal.bind(this));
$('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this));
},

/**
* Open dialog for external video
* @private
*/
_onOpenDialog: function (e, imageData) {

if (imageData['media_type'] !== 'external-video') {
return;
}
this.showModal();
},

/**
* Fired on trigger "openModal"
*/
showModal: function () {

$('#new-video').modal('openModal');
}
);
});

return $.mage.productGallery;
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
*/
-->
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Magento_ProductVideo::js/fotorama-add-video-events.js"/>
<link src="Magento_ProductVideo::js/load-player.js"/>
</head>
<body>
<referenceContainer name="product.info.media">
<block class="Magento\ProductVideo\Block\Product\View\Gallery" name="product.info.media.video" after="product.info.media.image" template="product/view/gallery.phtml"/>
Expand Down
29 changes: 15 additions & 14 deletions app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,29 @@ define([
}, 10);
};

this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
proceed();
this._parent.itemsArea.setNode($(this._parent.getAreaId('items')));
this._parent.itemsArea.onLoad();
});
if (jQuery('#' + this.getAreaId('items')).is(':visible')) {
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
proceed();
this._parent.itemsArea.setNode($(this._parent.getAreaId('items')));
this._parent.itemsArea.onLoad();
});

this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) {
proceed();
if ($(searchAreaId) && !$(searchAreaId).visible()) {
this.addControlButton(searchButton);
}
});
this.areasLoaded();
this.itemsArea.onLoad();
this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) {
proceed();
if ($(searchAreaId) && !$(searchAreaId).visible()) {
this.addControlButton(searchButton);
}
});
this.areasLoaded();
this.itemsArea.onLoad();
}
}).bind(this));

jQuery('#edit_form')
.on('submitOrder', function(){
jQuery(this).trigger('realOrder');
})
.on('realOrder', this._realSubmit.bind(this));

},

areasLoaded: function(){
Expand Down
13 changes: 7 additions & 6 deletions app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ define([
$.async(this.stickyContainerSelector,
this,
this.initContainerNode);
$.async(this.stickyElementSelector,
this.listing(),
this.initStickyListingNode);
$.async(this.stickyElementSelector,
this.toolbar(),
this.initStickyToolbarNode);

return this;
},
Expand Down Expand Up @@ -154,6 +148,13 @@ define([
$.async(this.rightDataGridCapSelector,
node,
this.initRightDataGridCap);

$.async(this.stickyElementSelector,
this.listing(),
this.initStickyListingNode);
$.async(this.stickyElementSelector,
this.toolbar(),
this.initStickyToolbarNode);
},

/**
Expand Down
64 changes: 64 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/lib/core/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,72 @@ define([
'use strict';

var root = 'appData',
localStorage = window.localStorage,
hasSupport,
storage;

/**
* Flag which indicates whether localStorage is supported.
*/
hasSupport = (function () {
var key = '_storageSupported';

try {
localStorage.setItem(key, 'true');

if (localStorage.getItem(key) === 'true') {
localStorage.removeItem(key);

return true;
}

return false;
} catch (e) {
return false;
}
})();

if (!hasSupport) {
localStorage = {
_data: {},

/**
* Sets value of the specified item.
*
* @param {String} key - Key of the property.
* @param {*} value - Properties' value.
*/
setItem: function (key, value) {
this._data[key] = value + '';
},

/**
* Retrieves specfied item.
*
* @param {String} key - Key of the property to be retrieved.
*/
getItem: function (key) {
return this._data[key];
},

/**
* Removes specfied item.
*
* @param {String} key - Key of the property to be removed.
*/
removeItem: function (key) {
delete this._data[key];
},

/**
* Removes all items.
*/
clear: function () {
this._data = {};
}
};
}

/**
* Extracts and parses data stored in localStorage by the
* key specified in 'root' varaible.
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Ui/view/base/web/js/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define([
*/
var transitionEvent = (function () {
var transition,
elementStyle = document.body.style,
elementStyle = document.createElement('div').style,
transitions = {
'transition': 'transitionend',
'OTransition': 'oTransitionEnd',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"disallowYodaConditions": true,
"maxErrors": null,
"requireBlocksOnNewline": true,
"requireDotNotation": "except_snake_case",
"requireCamelCaseOrUpperCaseIdentifiers": true,
Expand Down
5 changes: 5 additions & 0 deletions lib/web/fotorama/fotorama.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/web/mage/validation/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ define([], function () {
path.indexOf('vbscript:') !== -1) {
return false;
}

return true;
},

/**
Expand All @@ -44,7 +46,7 @@ define([], function () {
* @returns {String}
*/
sanitize: function (path) {
return path.Replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', '');
return path.replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', '');
}
};
});

0 comments on commit 0be91a5

Please sign in to comment.