Skip to content

Commit fc1d8e4

Browse files
author
Oleksandr Karpenko
committed
MAGETWO-49767: Merchant can't save & continue editing the Design Configuration
1 parent 135f967 commit fc1d8e4

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Theme\Block\Adminhtml\Design\Config\Edit;
7+
8+
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
9+
10+
class SaveAndContinueButton implements ButtonProviderInterface
11+
{
12+
13+
/**
14+
* @return array
15+
*/
16+
public function getButtonData()
17+
{
18+
return [
19+
'label' => __('Save and Continue'),
20+
'class' => 'save',
21+
'data_attribute' => [
22+
'mage-init' => [
23+
'button' => ['event' => 'saveAndContinue'],
24+
],
25+
'form-role' => 'saveAndContinue'
26+
],
27+
'sort_order' => 15,
28+
];
29+
}
30+
}

app/code/Magento/Theme/Block/Adminhtml/Design/Config/Edit/SaveButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SaveButton implements ButtonProviderInterface
1515
public function getButtonData()
1616
{
1717
return [
18-
'label' => __('Save'),
18+
'label' => __('Save Configuration'),
1919
'class' => 'save primary',
2020
'data_attribute' => [
2121
'mage-init' => ['button' => ['event' => 'save']],

app/code/Magento/Theme/Controller/Adminhtml/Design/Config/Save.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ public function execute()
7474

7575
$this->dataPersistor->clear('theme_design_config');
7676

77+
$returnToEdit = (bool)$this->getRequest()->getParam('back', false);
7778
$resultRedirect->setPath('theme/design_config/');
79+
if ($returnToEdit) {
80+
$resultRedirect->setPath('theme/design_config/edit', ['scope' => $scope, 'scope_id' => $scopeId]);
81+
}
7882
return $resultRedirect;
7983
} catch (LocalizedException $e) {
8084
$messages = explode("\n", $e->getMessage());

app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/Design/Config/SaveTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ public function testSave()
112112
$this->redirectFactory->expects($this->once())
113113
->method('create')
114114
->willReturn($this->redirect);
115-
$this->request->expects($this->exactly(2))
115+
$this->request->expects($this->exactly(3))
116116
->method('getParam')
117117
->withConsecutive(
118118
['scope'],
119-
['scope_id']
119+
['scope_id'],
120+
['back', false]
120121
)
121122
->willReturnOnConsecutiveCalls(
122123
$scope,
123-
$scopeId
124+
$scopeId,
125+
true
124126
);
125127
$this->request->expects($this->once())
126128
->method('getParams')
@@ -150,9 +152,12 @@ public function testSave()
150152
$this->dataPersistor->expects($this->once())
151153
->method('clear')
152154
->with('theme_design_config');
153-
$this->redirect->expects($this->once())
155+
$this->redirect->expects($this->exactly(2))
154156
->method('setPath')
155-
->with('theme/design_config/');
157+
->withConsecutive(
158+
['theme/design_config/'],
159+
['theme/design_config/edit', ['scope' => $scope, 'scope_id' => $scopeId]]
160+
);
156161

157162
$this->assertSame($this->redirect, $this->controller->execute());
158163
}

app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<item name="buttons" xsi:type="array">
2121
<item name="back" xsi:type="string">Magento\Theme\Block\Adminhtml\Design\Config\Edit\BackButton</item>
2222
<item name="save" xsi:type="string">Magento\Theme\Block\Adminhtml\Design\Config\Edit\SaveButton</item>
23+
<item name="save_and_continue" xsi:type="string">Magento\Theme\Block\Adminhtml\Design\Config\Edit\SaveAndContinueButton</item>
2324
</item>
2425
</argument>
2526
<dataSource name="design_config_form_data_source">

0 commit comments

Comments
 (0)