Skip to content

Commit 7ad03d2

Browse files
committed
Merge pull request #313 from magento-south/MAGETWO-5403
[South, Vanilla, WebDev] Apply Enhanced Data Grid as UI component in one area - CMS
2 parents 2f09fad + 077dbdc commit 7ad03d2

File tree

156 files changed

+6152
-2043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+6152
-2043
lines changed

app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,26 @@ $product = $block->getSaleableItem();
5858
data-tier-price="<?php echo $block->escapeHtml($block->jsonEncode($tierPriceData)); ?>">
5959
<?php echo __('Click for price'); ?></a>
6060
<?php else:
61-
echo __(
62-
'Buy %1 for %2',
63-
$price['price_qty'],
64-
$block->renderAmount(
65-
$price['price'],
66-
[
67-
'price_id' => $index,
68-
'id_suffix' => '-' . $index,
69-
'include_container' => true,
70-
'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION
71-
]
72-
)
61+
$priceAmountBlock = $block->renderAmount(
62+
$price['price'],
63+
[
64+
'price_id' => $index,
65+
'id_suffix' => '-' . $index,
66+
'include_container' => true,
67+
'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION
68+
]
7369
);
74-
?><?php echo __('each') ?>
75-
<?php if ($block->getShowDetailedPrice() !== false): ?>
76-
&nbsp;<?php echo __('and') ?>&nbsp;<strong class="benefit"><?php echo __('save')?>
77-
<span class="percent tier-<?php echo $index ?>">&nbsp;<?php echo $tierPriceModel->getSavePercent($price['price']) ?></span>%
78-
</strong>
79-
<?php endif ?>
70+
?>
71+
<?php echo ($block->getShowDetailedPrice() !== false)
72+
? __(
73+
'Buy %1 for %2 each and <strong class="benefit">save<span class="percent tier-%3">&nbsp;%4</span>%</strong>',
74+
$price['price_qty'],
75+
$priceAmountBlock,
76+
$index,
77+
$tierPriceModel->getSavePercent($price['price'])
78+
)
79+
: __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock);
80+
?>
8081
<?php endif; ?>
8182
</li>
8283
<?php endforeach; ?>

app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_index.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</item>
8484
<!-- Value of region_id field is filtered by the value of county_id attribute -->
8585
<item name="filterBy" xsi:type="array">
86-
<item name="target" xsi:type="string"><![CDATA[<%= provider %>:<%= parentScope %>.country_id]]></item>
86+
<item name="target" xsi:type="string">${ $.provider }:${ $.parentScope }.country_id</item>
8787
<item name="field" xsi:type="string">country_id</item>
8888
</item>
8989
</item>
@@ -314,7 +314,7 @@
314314
</item>
315315
</item>
316316
<item name="checkoutProvider" xsi:type="array">
317-
<item name="component" xsi:type="string">Magento_Ui/js/lib/provider</item>
317+
<item name="component" xsi:type="string">uiComponent</item>
318318
</item>
319319
</item>
320320
</argument>

app/code/Magento/Checkout/view/frontend/web/js/action/select-shipping-address.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ define(
5858
quote.setBillingAddress(null);
5959
quote.setFormattedBillingAddress(null);
6060
quote.setFormattedShippingAddress(null);
61-
quote.setSubtotal(null);
6261
if (typeof actionCallback == 'function') {
6362
actionCallback(false);
6463
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Controller\Adminhtml;
7+
8+
use Magento\Framework\Model\Resource\Db\Collection\AbstractCollection;
9+
10+
/**
11+
* Class AbstractMassStatus
12+
*/
13+
class AbstractMassStatus extends \Magento\Backend\App\Action
14+
{
15+
/**
16+
* Field id
17+
*/
18+
const ID_FIELD = 'entity_id';
19+
20+
/**
21+
* Redirect url
22+
*/
23+
const REDIRECT_URL = '*/*/';
24+
25+
/**
26+
* Resource collection
27+
*
28+
* @var string
29+
*/
30+
protected $collection = 'Magento\Framework\Model\Resource\Db\Collection\AbstractCollection';
31+
32+
/**
33+
* Model
34+
*
35+
* @var string
36+
*/
37+
protected $model = 'Magento\Framework\Model\AbstractModel';
38+
39+
40+
/**
41+
* Item status
42+
*
43+
* @var bool
44+
*/
45+
protected $status = true;
46+
/**
47+
* Execute action
48+
*
49+
* @return \Magento\Backend\Model\View\Result\Redirect
50+
* @throws \Magento\Framework\Exception\LocalizedException|\Exception
51+
*/
52+
public function execute()
53+
{
54+
$selected = $this->getRequest()->getParam('selected');
55+
$excluded = $this->getRequest()->getParam('excluded');
56+
57+
if (isset($excluded)) {
58+
if (!empty($excluded)) {
59+
$this->excludedSetStatus($excluded);
60+
} else {
61+
$this->setStatusAll();
62+
}
63+
} elseif (!empty($selected)) {
64+
$this->selectedSetStatus($selected);
65+
} else {
66+
$this->messageManager->addError(__('Please select item(s).'));
67+
}
68+
69+
return $this->getDefaultResult();
70+
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*
75+
* @return \Magento\Backend\Model\View\Result\Redirect
76+
*/
77+
public function getDefaultResult()
78+
{
79+
$resultRedirect = $this->resultRedirectFactory->create();
80+
return $resultRedirect->setPath(static::REDIRECT_URL);
81+
}
82+
83+
/**
84+
* Set status to all
85+
*
86+
* @return void
87+
* @throws \Exception
88+
*/
89+
protected function setStatusAll()
90+
{
91+
/** @var AbstractCollection $collection */
92+
$collection = $this->_objectManager->get($this->collection);
93+
$this->setStatus($collection);
94+
}
95+
96+
/**
97+
* Set status to all but the not selected
98+
*
99+
* @param array $excluded
100+
* @return void
101+
* @throws \Exception
102+
*/
103+
protected function excludedSetStatus(array $excluded)
104+
{
105+
/** @var AbstractCollection $collection */
106+
$collection = $this->_objectManager->get($this->collection);
107+
$collection->addFieldToFilter(static::ID_FIELD, ['nin' => $excluded]);
108+
$this->setStatus($collection);
109+
}
110+
111+
/**
112+
* Set status to selected items
113+
*
114+
* @param array $selected
115+
* @return void
116+
* @throws \Exception
117+
*/
118+
protected function selectedSetStatus(array $selected)
119+
{
120+
/** @var AbstractCollection $collection */
121+
$collection = $this->_objectManager->get($this->collection);
122+
$collection->addFieldToFilter(static::ID_FIELD, ['in' => $selected]);
123+
$this->setStatus($collection);
124+
}
125+
126+
/**
127+
* Set status to collection items
128+
*
129+
* @param AbstractCollection $collection
130+
* @return void
131+
*/
132+
protected function setStatus(AbstractCollection $collection)
133+
{
134+
foreach ($collection->getAllIds() as $id) {
135+
/** @var \Magento\Framework\Model\AbstractModel $model */
136+
$model = $this->_objectManager->get($this->model);
137+
$model->load($id);
138+
$model->setIsActive($this->status);
139+
$model->save();
140+
}
141+
}
142+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Controller\Adminhtml\Page;
7+
8+
use Magento\Cms\Controller\Adminhtml\AbstractMassStatus;
9+
10+
/**
11+
* Class MassDisable
12+
*/
13+
class MassDisable extends AbstractMassStatus
14+
{
15+
/**
16+
* Field id
17+
*/
18+
const ID_FIELD = 'page_id';
19+
20+
/**
21+
* Resource collection
22+
*
23+
* @var string
24+
*/
25+
protected $collection = 'Magento\Cms\Model\Resource\Page\Collection';
26+
27+
/**
28+
* Page model
29+
*
30+
* @var string
31+
*/
32+
protected $model = 'Magento\Cms\Model\Page';
33+
34+
/**
35+
* Page disable status
36+
*
37+
* @var boolean
38+
*/
39+
protected $status = false;
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Controller\Adminhtml\Page;
7+
8+
use Magento\Cms\Controller\Adminhtml\AbstractMassStatus;
9+
10+
/**
11+
* Class MassEnable
12+
*/
13+
class MassEnable extends AbstractMassStatus
14+
{
15+
/**
16+
* Field id
17+
*/
18+
const ID_FIELD = 'page_id';
19+
20+
/**
21+
* Resource collection
22+
*
23+
* @var string
24+
*/
25+
protected $collection = 'Magento\Cms\Model\Resource\Page\Collection';
26+
27+
/**
28+
* Page model
29+
*
30+
* @var string
31+
*/
32+
protected $model = 'Magento\Cms\Model\Page';
33+
34+
/**
35+
* Page enable status
36+
*
37+
* @var boolean
38+
*/
39+
protected $status = true;
40+
}

0 commit comments

Comments
 (0)