From 924fa7b1ef93970925576714813577ed53f877ce Mon Sep 17 00:00:00 2001 From: ikk0 Date: Tue, 10 May 2016 14:08:24 +0200 Subject: [PATCH 01/16] Add ability to use tree-massactions ("sub-menus") on Sales > Orders grid See pull request #2091 --- .../Sales/view/adminhtml/ui_component/sales_order_grid.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml index e0a5471b1e45e..3e242d9873e9b 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml @@ -64,6 +64,11 @@ + + + Magento_Ui/js/grid/tree-massactions + + From e3862231f93a80d5dc5fa643404f4381f1a2e86a Mon Sep 17 00:00:00 2001 From: Luke Hanley Date: Sun, 23 Apr 2017 18:12:27 +0100 Subject: [PATCH 02/16] Redis sess: fix path for persistent_identifier & compression_threshold The paths for both `persistent_identifier` & `compression_threshold` are prefixed with `param_`. This is against both the documentation and it does not follow the standard used throughout the configuration. https://github.com/magento/devdocs/blob/develop/guides/v2.0/config-guide/redis/redis-session.md#configure-magento-to-use-redis-for-session-storage --- .../Magento/Framework/Session/SaveHandler/Redis/Config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php b/lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php index 449457830ef17..6b7ab238c30ca 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php @@ -48,12 +48,12 @@ class Config implements \Cm\RedisSession\Handler\ConfigInterface /** * Configuration path for persistent identifier */ - const PARAM_PERSISTENT_IDENTIFIER = 'session/redis/param_persistent_identifier'; + const PARAM_PERSISTENT_IDENTIFIER = 'session/redis/persistent_identifier'; /** * Configuration path for compression threshold */ - const PARAM_COMPRESSION_THRESHOLD = 'session/redis/param_compression_threshold'; + const PARAM_COMPRESSION_THRESHOLD = 'session/redis/compression_threshold'; /** * Configuration path for compression library From 9af6782780fb5e7e40e893c3e74e11de49434db2 Mon Sep 17 00:00:00 2001 From: Nathan Toombs Date: Thu, 18 May 2017 12:26:11 -0500 Subject: [PATCH 03/16] Add froogaloop library as a dependency to load-player module --- .../ProductVideo/view/frontend/requirejs-config.js | 8 ++++++-- .../ProductVideo/view/frontend/web/js/load-player.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js index 6798905bf3300..fb0df732b87b0 100644 --- a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js +++ b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js @@ -7,7 +7,11 @@ var config = { map: { '*': { loadPlayer: 'Magento_ProductVideo/js/load-player', - fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events' + fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events', + vimeoAPI: 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js' } - } + }, + shim: { + vimeoAPI: {} + } }; diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js index f61e5ab0ee6bb..c4d15ae1018fa 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js @@ -7,7 +7,7 @@ @version 0.0.1 @requires jQuery & jQuery UI */ -define(['jquery', 'jquery/ui'], function ($) { +define(['jquery', 'jquery/ui', 'vimeoAPI'], function ($) { 'use strict'; var videoRegister = { From 922f99978fbf9e13eb1424a97fac691d76930093 Mon Sep 17 00:00:00 2001 From: Nathan Toombs Date: Mon, 22 May 2017 11:06:17 -0500 Subject: [PATCH 04/16] Update indentation to spaces --- .../ProductVideo/view/frontend/requirejs-config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js index fb0df732b87b0..a3baff97ea2e5 100644 --- a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js +++ b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js @@ -8,10 +8,10 @@ var config = { '*': { loadPlayer: 'Magento_ProductVideo/js/load-player', fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events', - vimeoAPI: 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js' + vimeoAPI: 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js' } }, - shim: { - vimeoAPI: {} - } + shim: { + vimeoAPI: {} + } }; From 8f91c2b0370d8d6669114e43b51bfaf902d3cff8 Mon Sep 17 00:00:00 2001 From: KasemNaoui Date: Mon, 29 May 2017 16:56:54 +0200 Subject: [PATCH 05/16] Coupon codes not showing in invoice print out #9216 --- app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php index 3a31aca1b5df5..715f68d3210a3 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php @@ -165,6 +165,6 @@ public function getAmount() */ public function getTitleDescription() { - return $this->getSource()->getDataUsingMethod($this->getTitleSourceField()); + return $this->getSource()->getOrder()->getData($this->getTitleSourceField()); } } From 1c51b54f22ff8957bf6cd5dce234bb70164fa7e6 Mon Sep 17 00:00:00 2001 From: Joke Puts Date: Wed, 31 May 2017 21:46:17 +0200 Subject: [PATCH 06/16] Use static:: instead of self:: to support late static bindings --- app/code/Magento/Sales/Model/Order/Creditmemo.php | 14 +++++++------- app/code/Magento/Sales/Model/Order/Invoice.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index e276eccb85b5a..823385c4b78d7 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -439,14 +439,14 @@ public function canVoid() */ public static function getStates() { - if (is_null(self::$_states)) { - self::$_states = [ + if (is_null(static::$_states)) { + static::$_states = [ self::STATE_OPEN => __('Pending'), self::STATE_REFUNDED => __('Refunded'), self::STATE_CANCELED => __('Canceled'), ]; } - return self::$_states; + return static::$_states; } /** @@ -461,11 +461,11 @@ public function getStateName($stateId = null) $stateId = $this->getState(); } - if (is_null(self::$_states)) { - self::getStates(); + if (is_null(static::$_states)) { + static::getStates(); } - if (isset(self::$_states[$stateId])) { - return self::$_states[$stateId]; + if (isset(static::$_states[$stateId])) { + return static::$_states[$stateId]; } return __('Unknown State'); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index 8b9fb91513250..622bc7783c119 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -543,14 +543,14 @@ public function addItem(\Magento\Sales\Model\Order\Invoice\Item $item) */ public static function getStates() { - if (null === self::$_states) { - self::$_states = [ + if (null === static::$_states) { + static::$_states = [ self::STATE_OPEN => __('Pending'), self::STATE_PAID => __('Paid'), self::STATE_CANCELED => __('Canceled'), ]; } - return self::$_states; + return static::$_states; } /** @@ -565,11 +565,11 @@ public function getStateName($stateId = null) $stateId = $this->getState(); } - if (null === self::$_states) { - self::getStates(); + if (null === static::$_states) { + static::getStates(); } - if (isset(self::$_states[$stateId])) { - return self::$_states[$stateId]; + if (isset(static::$_states[$stateId])) { + return static::$_states[$stateId]; } return __('Unknown State'); } From 849717c838dec94640bc73f66ca23f7b9f7b85f8 Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 7 Jun 2017 11:12:32 -0500 Subject: [PATCH 07/16] Fixed issue causing static test failure to report success/green on Travis Regression was introduced in e68d69c00de96afc3; can't use a script that does not exit on command failure or exit code is always zero for anything but the last command the script ran. Additionally, moved the test script back into .travis.yml because test failure inside a .sh script will not include sufficient error output. --- .travis.yml | 18 ++++++++++++++---- dev/travis/before_install.sh | 2 +- dev/travis/before_script.sh | 28 +++++++++++++++++----------- dev/travis/script.sh | 22 ---------------------- 4 files changed, 32 insertions(+), 38 deletions(-) delete mode 100755 dev/travis/script.sh diff --git a/.travis.yml b/.travis.yml index e477e56500b7a..649762d8e9f3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,12 @@ env: - MAGENTO_HOST_NAME="magento2.travis" matrix: - TEST_SUITE=unit + - TEST_SUITE=static + - TEST_SUITE=js GRUNT_COMMAND=spec + - TEST_SUITE=js GRUNT_COMMAND=static - TEST_SUITE=integration INTEGRATION_INDEX=1 - TEST_SUITE=integration INTEGRATION_INDEX=2 - TEST_SUITE=integration INTEGRATION_INDEX=3 - - TEST_SUITE=static - - TEST_SUITE=js - TEST_SUITE=functional ACCEPTANCE_INDEX=1 - TEST_SUITE=functional ACCEPTANCE_INDEX=2 matrix: @@ -34,7 +35,9 @@ matrix: - php: 7.0 env: TEST_SUITE=static - php: 7.0 - env: TEST_SUITE=js + env: TEST_SUITE=js GRUNT_COMMAND=spec + - php: 7.0 + env: TEST_SUITE=js GRUNT_COMMAND=static - php: 7.0 env: TEST_SUITE=functional ACCEPTANCE_INDEX=1 - php: 7.0 @@ -49,4 +52,11 @@ cache: before_install: ./dev/travis/before_install.sh install: composer install --no-interaction --prefer-dist before_script: ./dev/travis/before_script.sh -script: ./dev/travis/script.sh +script: + # Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails + - test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true + - test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true + + # The scripts for grunt/phpunit type tests + - if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi + - if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi diff --git a/dev/travis/before_install.sh b/dev/travis/before_install.sh index 5cf8c38cf16cd..63e1059f18abf 100755 --- a/dev/travis/before_install.sh +++ b/dev/travis/before_install.sh @@ -21,7 +21,7 @@ phpenv rehash; test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true # Node.js setup via NVM -if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then +if [ test $TEST_SUITE == "js" ]; then curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/dev/travis/before_script.sh b/dev/travis/before_script.sh index 2576be6e14094..7f6ef4f91ff48 100755 --- a/dev/travis/before_script.sh +++ b/dev/travis/before_script.sh @@ -75,22 +75,26 @@ case $TEST_SUITE in cat "$changed_files_ce" | sed 's/^/ + including /' cd ../../.. - - cp package.json.sample package.json - cp Gruntfile.js.sample Gruntfile.js - yarn ;; js) cp package.json.sample package.json cp Gruntfile.js.sample Gruntfile.js yarn - echo "Installing Magento" - mysql -uroot -e 'CREATE DATABASE magento2;' - php bin/magento setup:install -q --admin-user="admin" --admin-password="123123q" --admin-email="admin@example.com" --admin-firstname="John" --admin-lastname="Doe" - - echo "Deploying Static Content" - php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify + if [[ $GRUNT_COMMAND != "static" ]]; then + echo "Installing Magento" + mysql -uroot -e 'CREATE DATABASE magento2;' + php bin/magento setup:install -q \ + --admin-user="admin" \ + --admin-password="123123q" \ + --admin-email="admin@example.com" \ + --admin-firstname="John" \ + --admin-lastname="Doe" + + echo "Deploying Static Content" + php bin/magento setup:static-content:deploy -f -q -j=2 \ + --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify + fi ;; functional) echo "Installing Magento" @@ -117,7 +121,9 @@ case $TEST_SUITE in composer install && composer require se/selenium-server-standalone:2.53.1 export DISPLAY=:1.0 - sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log & + sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 \ + -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log & + cp ./phpunit.xml.dist ./phpunit.xml sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml diff --git a/dev/travis/script.sh b/dev/travis/script.sh deleted file mode 100755 index 9df242a367ba5..0000000000000 --- a/dev/travis/script.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -# Copyright © Magento, Inc. All rights reserved. -# See COPYING.txt for license details. - -case $TEST_SUITE in - static) - TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true - phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER - grunt static - ;; - js) - grunt spec - ;; - functional) - cd dev/tests/functional - vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug testsuites/Magento/Mtf/TestSuite/InjectableTests.php - ;; - *) - phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; - ;; -esac From 9aec90eb49ea026b644a422b276292faeed57f03 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Wed, 7 Jun 2017 19:47:12 +0200 Subject: [PATCH 08/16] Fixes layered navigation options being cached using the wrong store id. --- .../Attribute/Frontend/AbstractFrontend.php | 17 +++++++------ .../Frontend/DefaultFrontendTest.php | 25 +++++++++++++------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php index 32b72023340b5..8f1324195b382 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php @@ -13,7 +13,7 @@ use Magento\Framework\App\CacheInterface; use Magento\Framework\Serialize\Serializer\Json as Serializer; -use Magento\Store\Api\StoreResolverInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\App\ObjectManager; use Magento\Eav\Model\Cache\Type as CacheType; use Magento\Eav\Model\Entity\Attribute; @@ -37,9 +37,9 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F private $cache; /** - * @var StoreResolverInterface + * @var StoreManagerInterface */ - private $storeResolver; + private $storeManager; /** * @var Serializer @@ -66,22 +66,25 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F /** * @param BooleanFactory $attrBooleanFactory * @param CacheInterface $cache - * @param StoreResolverInterface $storeResolver + * @param $storeResolver @deprecated * @param array $cacheTags + * @param StoreManagerInterface $storeManager * @param Serializer $serializer * @codeCoverageIgnore + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( BooleanFactory $attrBooleanFactory, CacheInterface $cache = null, - StoreResolverInterface $storeResolver = null, + $storeResolver = null, array $cacheTags = null, + StoreManagerInterface $storeManager = null, Serializer $serializer = null ) { $this->_attrBooleanFactory = $attrBooleanFactory; $this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class); - $this->storeResolver = $storeResolver ?: ObjectManager::getInstance()->get(StoreResolverInterface::class); $this->cacheTags = $cacheTags ?: self::$defaultCacheTags; + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Serializer::class); } @@ -299,7 +302,7 @@ public function getSelectOptions() { $cacheKey = 'attribute-navigation-option-' . $this->getAttribute()->getAttributeCode() . '-' . - $this->storeResolver->getCurrentStoreId(); + $this->storeManager->getStore()->getId(); $optionString = $this->cache->load($cacheKey); if (false === $optionString) { $options = $this->getAttribute()->getSource()->getAllOptions(); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php index 5dd00fb3bc4fb..7ff2dc0b9f0df 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php @@ -8,7 +8,8 @@ use Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend; use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory; use Magento\Framework\Serialize\Serializer\Json as Serializer; -use Magento\Store\Api\StoreResolverInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Api\Data\StoreInterface; use Magento\Framework\App\CacheInterface; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; @@ -31,9 +32,14 @@ class DefaultFrontendTest extends \PHPUnit_Framework_TestCase private $serializerMock; /** - * @var StoreResolverInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $storeResolverMock; + private $storeManagerMock; + + /** + * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $storeMock; /** * @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject @@ -64,7 +70,9 @@ protected function setUp() ->getMock(); $this->serializerMock = $this->getMockBuilder(Serializer::class) ->getMock(); - $this->storeResolverMock = $this->getMockBuilder(StoreResolverInterface::class) + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->getMockForAbstractClass(); + $this->storeMock = $this->getMockBuilder(StoreInterface::class) ->getMockForAbstractClass(); $this->cacheMock = $this->getMockBuilder(CacheInterface::class) ->getMockForAbstractClass(); @@ -83,7 +91,7 @@ protected function setUp() [ '_attrBooleanFactory' => $this->booleanFactory, 'cache' => $this->cacheMock, - 'storeResolver' => $this->storeResolverMock, + 'storeManager' => $this->storeManagerMock, 'serializer' => $this->serializerMock, '_attribute' => $this->attributeMock, 'cacheTags' => $this->cacheTags @@ -188,8 +196,11 @@ public function testGetSelectOptions() $options = ['option1', 'option2']; $serializedOptions = "{['option1', 'option2']}"; - $this->storeResolverMock->expects($this->once()) - ->method('getCurrentStoreId') + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + $this->storeMock->expects($this->once()) + ->method('getId') ->willReturn($storeId); $this->attributeMock->expects($this->once()) ->method('getAttributeCode') From c7372f6305d986305c2e772f89b968f1a4947fdd Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Thu, 8 Jun 2017 17:08:33 +0300 Subject: [PATCH 09/16] MAGETWO-69690: Add froogaloop library as a dependency to load-player module #9690 --- .../view/frontend/requirejs-config.js | 3 +- .../web/js/fotorama-add-video-events.js | 54 ++++++++++++++++--- .../view/frontend/web/js/load-player.js | 2 +- .../web/css/source/_module.less | 6 +++ 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js index a3baff97ea2e5..17710d2c023ff 100644 --- a/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js +++ b/app/code/Magento/ProductVideo/view/frontend/requirejs-config.js @@ -7,8 +7,7 @@ var config = { map: { '*': { loadPlayer: 'Magento_ProductVideo/js/load-player', - fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events', - vimeoAPI: 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js' + fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events' } }, shim: { diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js index 74e34dbb38ecd..bb2439dffac0a 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js @@ -94,16 +94,20 @@ define([ options: { videoData: '', videoSettings: '', - optionsVideoData: '' + optionsVideoData: '', + vimeoJSFrameworkLoaded: false }, - + onVimeoJSFramework: function () {}, PV: 'product-video', // [CONST] VU: 'video-unplayed', PVLOADED: 'fotorama__product-video--loaded', // [CONST] + PVLOADING: 'fotorama__product-video--loading', // [CONST] VID: 'video', // [CONST] VI: 'vimeo', // [CONST] FTVC: 'fotorama__video-close', FTAR: 'fotorama__arr', + fotoramaSpinner: 'fotorama__spinner', + fotoramaSpinnerShow: 'fotorama__spinner--show', TI: 'video-thumb-icon', isFullscreen: false, FTCF: '[data-gallery-role="fotorama__fullscreen-icon"]', @@ -147,7 +151,6 @@ define([ * @private */ _setOptions: function (options) { - if (options.videoData && options.videoData.length) { this.options.videoData = options.videoData; } @@ -402,6 +405,14 @@ define([ element.async = true; element.src = 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js'; + + /** + * Vimeo js framework on load callback. + */ + element.onload = function () { + this.onVimeoJSFramework(); + this.vimeoJSFrameworkLoaded = true; + }.bind(this); scriptTag.parentNode.insertBefore(element, scriptTag); }, @@ -620,15 +631,41 @@ define([ }, /** - * - * @param {Event} event * @private */ - _clickHandler: function (event) { - if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) { + _showLoader: function () { + var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner); + + spinner.addClass(this.fotoramaSpinnerShow); + this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.addClass(this.PVLOADING); + }, + + /** + * @private + */ + _hideLoader: function () { + var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner); + + spinner.removeClass(this.fotoramaSpinnerShow); + this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.removeClass(this.PVLOADING); + }, + /** + * @param {Event} event + * @private + */ + _clickHandler: function (event) {if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) { $(event.target).removeClass(this.VU); - $(event.target).find('.' + this.PV).productVideoLoader(); + + if (this.vimeoJSFrameworkLoaded) { + $(event.target).find('.' + this.PV).productVideoLoader(); + } else { + this._showLoader(); + this.onVimeoJSFramework = function () { + $(event.target).find('.' + this.PV).productVideoLoader(); + this._hideLoader(); + }.bind(this); + } $('.' + this.FTAR).addClass(this.isFullscreen ? 'fotorama__arr--shown' : 'fotorama__arr--hidden'); } @@ -686,6 +723,7 @@ define([ } $wrapper.find('.' + this.PVLOADED).removeClass(this.PVLOADED); + this._hideLoader(); $wrapper.find('.' + this.PV).each(function () { var $item = $(this).parent(), diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js index c4d15ae1018fa..f61e5ab0ee6bb 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js @@ -7,7 +7,7 @@ @version 0.0.1 @requires jQuery & jQuery UI */ -define(['jquery', 'jquery/ui', 'vimeoAPI'], function ($) { +define(['jquery', 'jquery/ui'], function ($) { 'use strict'; var videoRegister = { diff --git a/app/design/frontend/Magento/blank/Magento_ProductVideo/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_ProductVideo/web/css/source/_module.less index f2fae8eca9177..023c531545963 100644 --- a/app/design/frontend/Magento/blank/Magento_ProductVideo/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_ProductVideo/web/css/source/_module.less @@ -83,6 +83,12 @@ top: 12px; width: 100px; } + + .fotorama__product-video--loading { + &:after { + visibility: hidden; + } + } } // From 1d40c9ac45d7fe3d1a490adad6603b4142e926a7 Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Fri, 9 Jun 2017 10:06:06 +0200 Subject: [PATCH 10/16] Improved error logging: original exception was not passed as $cause --- app/code/Magento/Catalog/Model/ProductRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index ceacfea5ec020..c91ae62544615 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -634,7 +634,7 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO } catch (LocalizedException $e) { throw $e; } catch (\Exception $e) { - throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product')); + throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'), $e); } unset($this->instances[$product->getSku()]); unset($this->instancesById[$product->getId()]); From 6237af99839c7ac32e44e29f9611b3fd6d3601bd Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 9 Jun 2017 12:05:41 +0300 Subject: [PATCH 11/16] MAGETWO-69370: Add ability to use tree-massactions ("sub-menus") on Sales > Orders grid #4450 - Updated configuration to use the correct format --- .../Sales/view/adminhtml/ui_component/sales_order_grid.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml index 4fdb115e0771c..38f5e7bdfc4a7 100644 --- a/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml +++ b/app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml @@ -56,12 +56,7 @@ - - - - Magento_Ui/js/grid/tree-massactions - - + From fdb0c7f401033b0c1d839abb539a592035fdd588 Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Fri, 9 Jun 2017 11:11:34 +0200 Subject: [PATCH 12/16] Added missing logging when saving a product fails --- app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php index d307055f22bbf..5a83fa3e34fa8 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php @@ -144,6 +144,7 @@ public function execute() $this->messageManager->addSuccess(__('You duplicated the product.')); } } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); $this->messageManager->addError($e->getMessage()); $this->getDataPersistor()->set('catalog_product', $data); $redirectBack = $productId ? true : 'new'; From 15d9415e970e45f2c2676a7a61610c0752159ce2 Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Fri, 9 Jun 2017 11:29:34 +0200 Subject: [PATCH 13/16] Added .DS_Store to .gitignore for Mac users --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e05169bb7c4a2..bae558e0e5b9a 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ atlassian* !/vendor/.htaccess /generated/* !/generated/.htaccess +.DS_Store From a31b6a08cdfdc35052a7bb5cb7c3c07d476bfc11 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 9 Jun 2017 17:06:49 +0300 Subject: [PATCH 14/16] MAGETWO-69689: Update CONTRIBUTING.md and README.md of Magento 2 CE repository --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0634653275a9a..2839ac5ee9d32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,3 +29,8 @@ If you are a new GitHub user, we recommend that you create your own [free github 3. Create and test your work. 4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request). 5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution. + +## Code of Conduct + +Please note that this project is released with a Contributor Code of Conduct. We expect you to agree to its terms when participating in this project. +The full text is available in the repository [Wiki](https://github.com/magento/magento2/wiki/Magento-Code-of-Conduct). From 58b4c7c312395dfe93ca12d8478a2379a104a476 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 9 Jun 2017 18:31:30 +0300 Subject: [PATCH 15/16] MAGETWO-69728: Fixes layered navigation options being cached using the wrong store id. #9873 - Backwards compatibility improvements --- .../Model/Entity/Attribute/Frontend/AbstractFrontend.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php index 8f1324195b382..d1794aff97fb9 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php @@ -68,8 +68,8 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F * @param CacheInterface $cache * @param $storeResolver @deprecated * @param array $cacheTags - * @param StoreManagerInterface $storeManager * @param Serializer $serializer + * @param StoreManagerInterface $storeManager * @codeCoverageIgnore * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -78,8 +78,8 @@ public function __construct( CacheInterface $cache = null, $storeResolver = null, array $cacheTags = null, - StoreManagerInterface $storeManager = null, - Serializer $serializer = null + Serializer $serializer = null, + StoreManagerInterface $storeManager = null ) { $this->_attrBooleanFactory = $attrBooleanFactory; $this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class); From 1098320f5e4d455f35ecc4cbb10c42506b2ef5c2 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 9 Jun 2017 18:36:43 +0300 Subject: [PATCH 16/16] MAGETWO-69690: Add froogaloop library as a dependency to load-player module #9690 - Coding style improvements --- .../view/frontend/web/js/fotorama-add-video-events.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js index bb2439dffac0a..790162526e45f 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js @@ -97,6 +97,10 @@ define([ optionsVideoData: '', vimeoJSFrameworkLoaded: false }, + + /** + * @private + */ onVimeoJSFramework: function () {}, PV: 'product-video', // [CONST] VU: 'video-unplayed', @@ -654,7 +658,8 @@ define([ * @param {Event} event * @private */ - _clickHandler: function (event) {if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) { + _clickHandler: function (event) { + if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) { $(event.target).removeClass(this.VU); if (this.vimeoJSFrameworkLoaded) {