Skip to content

Commit

Permalink
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce in…
Browse files Browse the repository at this point in the history
…to MAGETWO-43348
  • Loading branch information
Ievgen Sentiabov committed Oct 1, 2015
2 parents 8ca180f + 45863d7 commit 57750e2
Show file tree
Hide file tree
Showing 118 changed files with 2,069 additions and 1,948 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ $fieldClass .= ($note) ? ' with-note' : '';
$fieldClass .= (!$element->getLabelHtml()) ? ' no-label' : '';

$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
. $block->getUiId('form-field', $element->getId());
. $block->getUiId('form-field', $element->getId())
. ($element->getFieldExtraAttributes() ? ' ' . $element->getFieldExtraAttributes() : '');
?>

<?php if (!$element->getNoDisplay()): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function getTabClass()
*/
protected function _prepareLayout()
{
$this->setData('opened', true);
$this->addChild(
'add_button',
'Magento\Backend\Block\Widget\Button',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,29 @@ if(typeof Bundle=='undefined') {

</script>

<div
id="bundle_product_container"
class="entry-edit form-inline">
<div class="fieldset-wrapper admin__collapsible-block-wrapper collapsible-block-wrapper-last" id="bundle_product-wrapper">
<div class="fieldset-wrapper-title">
<strong class="admin__collapsible-title" data-toggle="collapse" data-target="#bundle_product-content">
<span><?php /* @escapeNotVerified */ echo $block->getTabLabel() ?></span>
</strong>
<div id="bundle_product_container" class="entry-edit form-inline">
<fieldset class="fieldset">
<div class="field field-ship-bundle-items">
<label for="shipment_type" class="label"><?php /* @escapeNotVerified */ echo __('Ship Bundle Items') ?></label>
<div class="control">
<select <?php if ($block->isReadonly()): ?>disabled="disabled" <?php endif;?>
id="shipment_type"
name="<?php /* @escapeNotVerified */ echo $block->getFieldSuffix() ?>[shipment_type]"
class="select">
<option value="1"><?php /* @escapeNotVerified */ echo __('Separately') ?></option>
<option value="0"<?php if ($block->getProduct()->getShipmentType() == 0): ?> selected="selected"<?php endif; ?>><?php /* @escapeNotVerified */ echo __('Together') ?></option>
</select>
</div>
</div>
<div class="fieldset-wrapper-content collapse" id="bundle_product-content">
<fieldset class="fieldset">
<div class="field field-ship-bundle-items">
<label for="shipment_type" class="label"><?php /* @escapeNotVerified */ echo __('Ship Bundle Items') ?></label>
<div class="control">
<select <?php if ($block->isReadonly()): ?>disabled="disabled" <?php endif;?>
id="shipment_type"
name="<?php /* @escapeNotVerified */ echo $block->getFieldSuffix() ?>[shipment_type]"
class="select">
<option value="1"><?php /* @escapeNotVerified */ echo __('Separately') ?></option>
<option value="0"<?php if ($block->getProduct()->getShipmentType() == 0): ?> selected="selected"<?php endif; ?>><?php /* @escapeNotVerified */ echo __('Together') ?></option>
</select>
</div>
</div>

<div
id="product_bundle_container"
class="entry-edit custom-options bundle sortable-wrapper">
<?php echo $block->getOptionsBoxHtml() ?>
</div>

<?php echo $block->getAddButtonHtml() ?>
</fieldset>
<div
id="product_bundle_container"
class="entry-edit custom-options bundle sortable-wrapper">
<?php echo $block->getOptionsBoxHtml() ?>
</div>
</div>

<?php echo $block->getAddButtonHtml() ?>
</fieldset>
</div>

<input type="hidden" name="affect_bundle_product_selections" value="1" />
Expand Down
22 changes: 20 additions & 2 deletions app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,27 @@
}

.field-weight .weight {
width: 140px;
display: inline-block;
margin-right: 15px;
float: left;
vertical-align: top;
width: 140px;
}

.field-weight .weight .admin__control-addon .input-text {
min-width: 10rem;
}

.field-weight .weight .admin__control-addon .input-text,
.field-weight .weight .admin__control-addon .admin__addon-suffix {
flex-basis: 10rem;
}

.ie9 .field-weight .weight .admin__control-addon .input-text {
width: 100px;
}

.weight-switcher .admin__control-addon {
width: 100%;
}

.field-weight .weight .field:first-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
/*global $H*/
define([
"jquery",
"Magento_Catalog/js/product/weight-handler",
"jquery/ui",
"mage/translate",
"Magento_Theme/js/sortable",
"prototype"
], function($){
], function ($, weightHandler) {
'use strict';

$.widget('mage.bundleProduct', {
Expand Down Expand Up @@ -188,7 +189,7 @@ define([
return this;
},
_hideProductTypeSwitcher: function () {
$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
weightHandler.hideWeightSwitcher();
},
_bindCheckboxHandlers: function () {
this._on({
Expand Down
4 changes: 3 additions & 1 deletion app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Customer edit block
*
* @author Magento Core Team <core@magentocommerce.com>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
namespace Magento\Catalog\Block\Adminhtml\Product;

Expand Down Expand Up @@ -310,7 +311,8 @@ public function getTypeSwitcherData()
return $this->jsonEncoder->encode(
[
'tab_id' => 'product_info_tabs_downloadable_items',
'is_virtual_id' => \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight::VIRTUAL_FIELD_HTML_ID,
'weight_switcher' => '[data-role=weight-switcher]',
'product_has_weight_flag' => \Magento\Catalog\Model\Product\Edit\WeightResolver::HAS_WEIGHT,
'weight_id' => 'weight',
'current_type' => $this->getProduct()->getTypeId(),
'attributes' => $this->_getAttributes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ protected function _getAdditionalElementHtml($element)
HTML;
if ($elementId === 'weight') {
$html .= <<<HTML
<script>require(["jquery"],function($) {
$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
<script>require(['Magento_Catalog/js/product/weight-handler'], function (weightHandle) {
weightHandle.hideWeightSwitcher();
});</script>
HTML;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Product Child tab
*/
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab;

class ChildTab extends \Magento\Backend\Block\Template
{
/**
* @var \Magento\Backend\Block\Widget\Tab\TabInterface
*/
protected $tab;

/**
* @param \Magento\Backend\Block\Widget\Tab\TabInterface $tab
* @return $this
*/
public function setTab(\Magento\Backend\Block\Widget\Tab\TabInterface $tab)
{
$this->tab = $tab;
return $this;
}

/**
* @return string
*/
public function getTitle()
{
return $this->tab->getTabTitle();
}

/**
* @return string
*/
public function getContent()
{
return $this->tab->toHtml();
}

/**
* @return string
*/
public function getTabId()
{
return $this->tab->getTabId();
}

/**
* @return bool
*/
public function isTabOpened()
{
return (bool)$this->tab->getData('opened');
}
}
82 changes: 55 additions & 27 deletions app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@
* See COPYING.txt for license details.
*/

namespace Magento\Catalog\Block\Adminhtml\Product\Edit;

use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Accordion;
use Magento\Backend\Block\Widget\Tabs as WigetTabs;
use Magento\Backend\Model\Auth\Session;
use Magento\Catalog\Helper\Catalog;
use Magento\Catalog\Helper\Data;
use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory;
use Magento\Framework\Json\EncoderInterface;
use Magento\Framework\Module\Manager;
use Magento\Framework\Registry;
use Magento\Framework\Translate\InlineInterface;

/**
* Admin product edit tabs
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
namespace Magento\Catalog\Block\Adminhtml\Product\Edit;

class Tabs extends \Magento\Backend\Block\Widget\Tabs
class Tabs extends WigetTabs
{
const BASIC_TAB_GROUP_CODE = 'basic';

Expand All @@ -28,62 +41,62 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
/**
* Core registry
*
* @var \Magento\Framework\Registry
* @var Registry
*/
protected $_coreRegistry = null;

/**
* Catalog data
*
* @var \Magento\Catalog\Helper\Data
* @var Data
*/
protected $_catalogData = null;

/**
* Adminhtml catalog
*
* @var \Magento\Catalog\Helper\Catalog
* @var Catalog
*/
protected $_helperCatalog = null;

/**
* @var \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory
* @var CollectionFactory
*/
protected $_collectionFactory;

/**
* @var \Magento\Framework\Module\Manager
* @var Manager
*/
protected $_moduleManager;

/**
* @var \Magento\Framework\Translate\InlineInterface
* @var InlineInterface
*/
protected $_translateInline;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
* @param \Magento\Backend\Model\Auth\Session $authSession
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory
* @param \Magento\Catalog\Helper\Catalog $helperCatalog
* @param \Magento\Catalog\Helper\Data $catalogData
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Translate\InlineInterface $translateInline
* @param Context $context
* @param EncoderInterface $jsonEncoder
* @param Session $authSession
* @param Manager $moduleManager
* @param CollectionFactory $collectionFactory
* @param Catalog $helperCatalog
* @param Data $catalogData
* @param Registry $registry
* @param InlineInterface $translateInline
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
\Magento\Backend\Model\Auth\Session $authSession,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory,
\Magento\Catalog\Helper\Catalog $helperCatalog,
\Magento\Catalog\Helper\Data $catalogData,
\Magento\Framework\Registry $registry,
\Magento\Framework\Translate\InlineInterface $translateInline,
Context $context,
EncoderInterface $jsonEncoder,
Session $authSession,
Manager $moduleManager,
CollectionFactory $collectionFactory,
Catalog $helperCatalog,
Data $catalogData,
Registry $registry,
InlineInterface $translateInline,
array $data = []
) {
$this->_moduleManager = $moduleManager;
Expand Down Expand Up @@ -322,4 +335,19 @@ protected function _translateHtml($html)
$this->_translateInline->processResponseBody($html);
return $html;
}

/**
* @param string $parentTab
* @return string
*/
public function getAccordion($parentTab)
{
$html = '';
foreach ($this->_tabs as $childTab) {
if ($childTab->getParentTab() === $parentTab->getId()) {
$html .= $this->getChildBlock('child-tab')->setTab($childTab)->toHtml();
}
}
return $html;
}
}
Loading

0 comments on commit 57750e2

Please sign in to comment.