Skip to content

Commit

Permalink
⬆️ Merge pull request #936 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests:

#7562
#8896
#8766
#8912
#8909
#8901
#8484
#8822
  • Loading branch information
Oleksii Korshenko authored Mar 17, 2017
2 parents c6d14d1 + 29cc859 commit 5405209
Show file tree
Hide file tree
Showing 17 changed files with 475 additions and 199 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ atlassian*
/.grunt
/Gruntfile.js
/package.json
/.php_cs
/.php_cs.cache
/grunt-config.json
/dev/tools/grunt/configs/local-themes.js

Expand Down
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
order allow,deny
deny from all
</Files>
<Files .php_cs>
<Files .php_cs.dist>
order allow,deny
deny from all
</Files>
Expand Down
2 changes: 1 addition & 1 deletion .htaccess.sample
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
order allow,deny
deny from all
</Files>
<Files .php_cs>
<Files .php_cs.dist>
order allow,deny
deny from all
</Files>
Expand Down
52 changes: 0 additions & 52 deletions .php_cs

This file was deleted.

49 changes: 49 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Pre-commit hook installation:
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
*/
$finder = PhpCsFixer\Finder::create()
->name('*.phtml')
->exclude('dev/tests/functional/generated')
->exclude('dev/tests/functional/var')
->exclude('dev/tests/functional/vendor')
->exclude('dev/tests/integration/tmp')
->exclude('dev/tests/integration/var')
->exclude('lib/internal/Cm')
->exclude('lib/internal/Credis')
->exclude('lib/internal/Less')
->exclude('lib/internal/LinLibertineFont')
->exclude('pub/media')
->exclude('pub/static')
->exclude('setup/vendor')
->exclude('var');

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'include' => true,
'new_with_braces' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
]);
22 changes: 11 additions & 11 deletions app/code/Magento/AdminNotification/i18n/en_US.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"Read Details","Read Details"
"Mark as Read","Mark as Read"
"Are you sure?","Are you sure?"
Remove,Remove
"Remove","Remove"
"Messages Inbox","Messages Inbox"
"You have %1 new system messages","You have %1 new system messages"
"You have %1 new system message","You have %1 new system message"
"Incoming Message","Incoming Message"
close,close
Notifications,Notifications
"close","close"
"Notifications","Notifications"
"The message has been marked as Read.","The message has been marked as Read."
"We couldn't mark the notification as Read because of an error.","We couldn't mark the notification as Read because of an error."
"Please select messages.","Please select messages."
Expand All @@ -20,10 +20,10 @@ Notifications,Notifications
"6 Hours","6 Hours"
"12 Hours","12 Hours"
"24 Hours","24 Hours"
critical,critical
major,major
minor,minor
notice,notice
"critical","critical"
"major","major"
"minor","minor"
"notice","notice"
"Wrong message type","Wrong message type"
"Wrong notification ID specified.","Wrong notification ID specified."
"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>.","{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>."
Expand All @@ -33,7 +33,7 @@ notice,notice
"Synchronization of media storages has been completed.","Synchronization of media storages has been completed."
"Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider.","Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider."
"Close popup","Close popup"
Close,Close
"Close","Close"
"System Messages:","System Messages:"
"Critical System Messages","Critical System Messages"
"Major System Messages","Major System Messages"
Expand All @@ -45,7 +45,7 @@ Close,Close
"Use HTTPS to Get Feed","Use HTTPS to Get Feed"
"Update Frequency","Update Frequency"
"Last Update","Last Update"
Severity,Severity
"Severity","Severity"
"Date Added","Date Added"
Message,Message
Actions,Actions
"Message","Message"
"Actions","Actions"
2 changes: 1 addition & 1 deletion app/code/Magento/Checkout/Block/Cart/AbstractCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AbstractCart extends \Magento\Framework\View\Element\Template
protected $_customerSession;

/**
* @var \Magento\Customer\Model\Session
* @var \Magento\Checkout\Model\Session
*/
protected $_checkoutSession;

Expand Down
23 changes: 22 additions & 1 deletion app/code/Magento/Directory/Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,28 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
['BR', 'SP', 'São Paulo'],
['BR', 'SE', 'Sergipe'],
['BR', 'TO', 'Tocantins'],
['BR', 'DF', 'Distrito Federal']
['BR', 'DF', 'Distrito Federal'],
['HR', 'HR-01', 'Zagrebačka županija'],
['HR', 'HR-02', 'Krapinsko-zagorska županija'],
['HR', 'HR-03', 'Sisačko-moslavačka županija'],
['HR', 'HR-04', 'Karlovačka županija'],
['HR', 'HR-05', 'Varaždinska županija'],
['HR', 'HR-06', 'Koprivničko-križevačka županija'],
['HR', 'HR-07', 'Bjelovarsko-bilogorska županija'],
['HR', 'HR-08', 'Primorsko-goranska županija'],
['HR', 'HR-09', 'Ličko-senjska županija'],
['HR', 'HR-10', 'Virovitičko-podravska županija'],
['HR', 'HR-11', 'Požeško-slavonska županija'],
['HR', 'HR-12', 'Brodsko-posavska županija'],
['HR', 'HR-13', 'Zadarska županija'],
['HR', 'HR-14', 'Osječko-baranjska županija'],
['HR', 'HR-15', 'Šibensko-kninska županija'],
['HR', 'HR-16', 'Vukovarsko-srijemska županija'],
['HR', 'HR-17', 'Splitsko-dalmatinska županija'],
['HR', 'HR-18', 'Istarska županija'],
['HR', 'HR-19', 'Dubrovačko-neretvanska županija'],
['HR', 'HR-20', 'Međimurska županija'],
['HR', 'HR-21', 'Grad Zagreb']
];

foreach ($data as $row) {
Expand Down
5 changes: 3 additions & 2 deletions app/code/Magento/Directory/etc/zip_codes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@
</zip>
<zip countryCode="MT">
<codes>
<code id="pattern_1" active="true" example="ABC 123">^[a-zA-Z]{3}\s[0-9]{3}$</code>
<code id="pattern_2" active="true" example="ABC 12">^[a-zA-Z]{3}\s[0-9]{2}$</code>
<code id="pattern_1" active="true" example="ABC 1234">^[a-zA-Z]{3}\s[0-9]{4}$</code>
<code id="pattern_2" active="true" example="ABC 123">^[a-zA-Z]{3}\s[0-9]{3}$</code>
<code id="pattern_3" active="true" example="ABC 12">^[a-zA-Z]{3}\s[0-9]{2}$</code>
</codes>
</zip>
<zip countryCode="MH">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public function beforeSave($object)
$attributeCode = $this->getAttribute()->getAttributeCode();
$data = $object->getData($attributeCode);
if (is_array($data)) {
$data = array_filter($data);
$data = array_filter($data, function ($value) {
return $value === '0' || !empty($value);
});
$object->setData($attributeCode, implode(',', $data));
}

Expand Down
65 changes: 42 additions & 23 deletions app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ define([
_create: function () {
var options = this.options,
gallery = $('[data-gallery-role=gallery-placeholder]', '.column.main'),
isProductViewExist = $('body.catalog-product-view').size() > 0,
$main = isProductViewExist ?
productData = this._determineProductData(),
$main = productData.isInProductView ?
this.element.parents('.column.main') :
this.element.parents('.product-item-info');

if (isProductViewExist) {
if (productData.isInProductView) {
gallery.data('gallery') ?
this._onGalleryLoaded(gallery) :
gallery.on('gallery:loaded', this._onGalleryLoaded.bind(this, gallery));
Expand All @@ -328,6 +328,34 @@ define([
this.inProductList = this.productForm.length > 0;
},

/**
* Determine product id and related data
*
* @returns {{productId: *, isInProductView: bool}}
* @private
*/
_determineProductData: function () {
// Check if product is in a list of products.
var productId,
product,
isInProductView = false;

productId = this.element.parents('.product-item-details')
.find('.price-box.price-final_price').attr('data-product-id');

if (!productId) {
// Check individual product.
product = document.getElementsByName('product')[0];
productId = product ? product.value : undefined;
isInProductView = productId > 0;
}

return {
productId: productId,
isInProductView: isInProductView
};
},

/**
* Render controls
*
Expand Down Expand Up @@ -897,7 +925,7 @@ define([
var $widget = this,
$this = $widget.element,
attributes = {},
productId = 0,
productData = this._determineProductData(),
mediaCallData,
mediaCacheKey,

Expand All @@ -911,7 +939,7 @@ define([
if (!(mediaCacheKey in $widget.options.mediaCache)) {
$widget.options.mediaCache[mediaCacheKey] = data;
}
$widget._ProductMediaCallback($this, data);
$widget._ProductMediaCallback($this, data, productData.isInProductView);
$widget._DisableProductMediaLoader($this);
};

Expand All @@ -925,17 +953,8 @@ define([
attributes[$selected.attr('attribute-code')] = $selected.attr('option-selected');
});

if ($('body.catalog-product-view').size() > 0) {
//Product Page
productId = document.getElementsByName('product')[0].value;
} else {
//Category View
productId = $this.parents('.product.details.product-item-details')
.find('.price-box.price-final_price').attr('data-product-id');
}

mediaCallData = {
'product_id': productId,
'product_id': productData.productId,
'attributes': attributes,
'additional': $.parseQuery()
};
Expand Down Expand Up @@ -1001,11 +1020,11 @@ define([
*
* @param {Object} $this
* @param {String} response
* @param {Boolean} isInProductView
* @private
*/
_ProductMediaCallback: function ($this, response) {
var isProductViewExist = $('body.catalog-product-view').size() > 0,
$main = isProductViewExist ? $this.parents('.column.main') : $this.parents('.product-item-info'),
_ProductMediaCallback: function ($this, response, isInProductView) {
var $main = isInProductView ? $this.parents('.column.main') : $this.parents('.product-item-info'),
$widget = this,
images = [],

Expand All @@ -1020,7 +1039,7 @@ define([
};

if (_.size($widget) < 1 || !support(response)) {
this.updateBaseImage(this.options.mediaGalleryInitial, $main, isProductViewExist);
this.updateBaseImage(this.options.mediaGalleryInitial, $main, isInProductView);

return;
}
Expand All @@ -1045,7 +1064,7 @@ define([
});
}

this.updateBaseImage(images, $main, isProductViewExist);
this.updateBaseImage(images, $main, isInProductView);
},

/**
Expand All @@ -1070,16 +1089,16 @@ define([
* Update [gallery-placeholder] or [product-image-photo]
* @param {Array} images
* @param {jQuery} context
* @param {Boolean} isProductViewExist
* @param {Boolean} isInProductView
*/
updateBaseImage: function (images, context, isProductViewExist) {
updateBaseImage: function (images, context, isInProductView) {
var justAnImage = images[0],
initialImages = this.options.mediaGalleryInitial,
gallery = context.find(this.options.mediaGallerySelector).data('gallery'),
imagesToUpdate,
isInitial;

if (isProductViewExist) {
if (isInProductView) {
imagesToUpdate = images.length ? this._setImageType($.extend(true, [], images)) : [];
isInitial = _.isEqual(imagesToUpdate, initialImages);

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Theme/Block/Html/Topmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected function _addSubMenu($child, $childLevel, $childrenWrapClass, $limit)
$colStops = $this->_columnBrake($child->getChildren(), $limit);
}

$html .= '<ul class="level' . $childLevel . ' submenu">';
$html .= '<ul class="level' . $childLevel . ' ' . $childrenWrapClass .'">';
$html .= $this->_getHtml($child, $childrenWrapClass, $limit, $colStops);
$html .= '</ul>';

Expand Down
Loading

0 comments on commit 5405209

Please sign in to comment.