-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #419 from magento-tango/MAGETWO-50128
[Tango] Configurable Product, Product Attributes, Bug Fixes
- Loading branch information
Showing
175 changed files
with
10,195 additions
and
926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
define([ | ||
'Magento_Ui/js/form/element/select', | ||
'uiRegistry' | ||
], function (Select, registry) { | ||
'use strict'; | ||
|
||
return Select.extend({ | ||
defaults: { | ||
previousType: '', | ||
parentContainer: '', | ||
selections: '', | ||
targetIndex: '', | ||
typeMap: {} | ||
}, | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
onUpdate: function () { | ||
var type = this.typeMap[this.value()]; | ||
|
||
if (type !== this.previousType) { | ||
this.previousType = type; | ||
|
||
if (type === 'radio') { | ||
this.clearValues(); | ||
} | ||
} | ||
|
||
this._super(); | ||
}, | ||
|
||
/** | ||
* Clears values in components like this. | ||
*/ | ||
clearValues: function () { | ||
var records = registry.get(this.retrieveParentName(this.parentContainer) + '.' + this.selections), | ||
checkedFound = false; | ||
|
||
records.elems.each(function (record) { | ||
record.elems.filter(function (comp) { | ||
return comp.index === this.targetIndex; | ||
}, this).each(function (comp) { | ||
if (comp.checked()) { | ||
if (checkedFound) { | ||
comp.clearing = true; | ||
comp.clear(); | ||
comp.clearing = false; | ||
} | ||
|
||
checkedFound = true; | ||
} | ||
}); | ||
}, this); | ||
}, | ||
|
||
/** | ||
* Retrieve name for the most global parent with provided index. | ||
* | ||
* @param {String} parent - parent name. | ||
* @returns {String} | ||
*/ | ||
retrieveParentName: function (parent) { | ||
return this.name.replace(new RegExp('^(.+?\\.)?' + parent + '\\..+'), '$1' + parent); | ||
} | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Button/Cancel.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Button; | ||
|
||
/** | ||
* Class Cancel | ||
*/ | ||
class Cancel extends Generic | ||
{ | ||
/** | ||
* Get button data | ||
* | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Cancel'), | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'Magento_Ui/js/form/button-adapter' => [ | ||
'actions' => [ | ||
[ | ||
'targetName' => 'product_form.product_form.add_attribute_modal' | ||
. '.create_new_attribute_modal', | ||
'actionName' => 'toggleModal' | ||
] | ||
] | ||
] | ||
] | ||
], | ||
'on_click' => '' | ||
]; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Button/Generic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Button; | ||
|
||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\Framework\Registry; | ||
use Magento\Framework\View\Element\UiComponent\Context; | ||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
/** | ||
* Class Generic | ||
*/ | ||
class Generic implements ButtonProviderInterface | ||
{ | ||
/** | ||
* Url Builder | ||
* | ||
* @var Context | ||
*/ | ||
protected $context; | ||
|
||
/** | ||
* Registry | ||
* | ||
* @var Registry | ||
*/ | ||
protected $registry; | ||
|
||
/** | ||
* Generic constructor | ||
* | ||
* @param Context $context | ||
* @param Registry $registry | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Registry $registry | ||
) { | ||
$this->context = $context; | ||
$this->registry = $registry; | ||
} | ||
|
||
/** | ||
* Generate url by route and parameters | ||
* | ||
* @param string $route | ||
* @param array $params | ||
* @return string | ||
*/ | ||
public function getUrl($route = '', $params = []) | ||
{ | ||
return $this->context->getUrl($route, $params); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return []; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Button/Save.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Button; | ||
|
||
class Save extends Generic | ||
{ | ||
/** | ||
* Get button data | ||
* | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Save Attribute'), | ||
'class' => 'save primary', | ||
'data_attribute' => [ | ||
'mage-init' => ['button' => ['event' => 'save']], | ||
'form-role' => 'save', | ||
] | ||
]; | ||
} | ||
} |
Oops, something went wrong.