Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into MAGETWO-66374
Browse files Browse the repository at this point in the history
  • Loading branch information
balex13 committed Apr 24, 2017
2 parents 643d3ca + e0bd129 commit 59931bc
Show file tree
Hide file tree
Showing 218 changed files with 1,477 additions and 1,292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<block class="Magento\AdminNotification\Block\Window"
name="notification_window"
as="notification_window"
acl="Magento_AdminNotification::show_toolbar"
aclResource="Magento_AdminNotification::show_toolbar"
template="Magento_AdminNotification::notification/window.phtml"/>
</referenceContainer>
<referenceContainer name="header">
Expand Down
22 changes: 17 additions & 5 deletions app/code/Magento/Analytics/Model/Condition/CanViewNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Analytics\Model\Condition;

use Magento\Backend\Model\View\Layout\ConditionInterface;
use Magento\Framework\View\Layout\Condition\VisibilityConditionInterface;
use Magento\Analytics\Model\NotificationTime;
use Magento\Framework\Intl\DateTimeFactory;

Expand All @@ -16,8 +15,13 @@
* Dynamic validator for UI signUp notification form, manage Ui component visibility.
* Return true if last notification was shipped seven days ago.
*/
class CanViewNotification implements ConditionInterface
class CanViewNotification implements VisibilityConditionInterface
{
/**
* Unique condition name.
*/
const NAME = 'can_view_notification';

/**
* Time interval in seconds
*
Expand Down Expand Up @@ -52,9 +56,9 @@ public function __construct(
/**
* Validate is notification popup can be shown
*
* @return bool
* @inheritdoc
*/
public function validate()
public function isVisible(array $arguments)
{
$lastNotificationTime = $this->notificationTime->getLastTimeNotification();
if (!$lastNotificationTime) {
Expand All @@ -65,4 +69,12 @@ public function validate()
$datetime->getTimestamp() >= $lastNotificationTime + $this->notificationInterval
);
}

/**
* @return string
*/
public function getName()
{
return self::NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testValidate()
$this->dateTimeMock->expects($this->once())
->method('getTimestamp')
->willReturn(10005000);
$this->assertTrue($this->canViewNotification->validate());
$this->assertTrue($this->canViewNotification->isVisible([]));
}

public function testValidateFlagRemoved()
Expand All @@ -76,6 +76,6 @@ public function testValidateFlagRemoved()
->willReturn(null);
$this->dateTimeFactoryMock->expects($this->never())
->method('create');
$this->assertFalse($this->canViewNotification->validate());
$this->assertFalse($this->canViewNotification->isVisible([]));
}
}
7 changes: 0 additions & 7 deletions app/code/Magento/Analytics/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
</argument>
</arguments>
</type>
<type name="Magento\Backend\Model\View\Layout\ConditionPool">
<arguments>
<argument name="conditions" xsi:type="array">
<item name="analytics::can-view-notification" xsi:type="string">Magento\Analytics\Model\Condition\CanViewNotification</item>
</argument>
</arguments>
</type>
<type name="Magento\Analytics\Controller\Adminhtml\Subscription\Activate">
<arguments>
<argument name="configValueResource" xsi:type="object">Magento\Config\Model\ResourceModel\Config\Data</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<uiComponent name="analytics_subscription_form" acl="Magento_Analytics::analytics_settings"
condition="analytics::can-view-notification"/>
<uiComponent name="analytics_subscription_form" aclResource="Magento_Analytics::analytics_settings">
<visibilityCondition name="can_view_notification" className="Magento\Analytics\Model\Condition\CanViewNotification"/>
</uiComponent>
<block template="Magento_Analytics::dashboard/section.phtml"
class="Magento\Backend\Block\Template"
name="analytics_service_external_link"
Expand Down
21 changes: 13 additions & 8 deletions app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
$storeModel->setData($postData['store']);
}
$fieldset = $form->addFieldset('store_fieldset', ['legend' => __('Store View Information')]);

$storeAction = $this->_coreRegistry->registry('store_action');
if ($storeAction == 'edit' || $storeAction == 'add') {
$fieldset->addField(
Expand All @@ -76,7 +75,6 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
);
$fieldset = $this->prepareGroupIdField($form, $storeModel, $fieldset);
}

$fieldset->addField(
'store_name',
'text',
Expand All @@ -99,7 +97,8 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
'disabled' => $storeModel->isReadOnly()
]
);

$isDisabledStatusField = $storeModel->isReadOnly()
|| ($storeModel->getId() && $storeModel->isDefault() && $storeModel->isActive());
$fieldset->addField(
'store_is_active',
'select',
Expand All @@ -109,11 +108,19 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
'value' => $storeModel->isActive(),
'options' => [0 => __('Disabled'), 1 => __('Enabled')],
'required' => true,
'disabled' => $storeModel->isReadOnly()
|| ($storeModel->getId() && $storeModel->isDefault() && $storeModel->isActive())
'disabled' => $isDisabledStatusField
]
);

if ($isDisabledStatusField) {
$fieldset->addField(
'store_is_active_hidden',
'hidden',
[
'name' => 'store[is_active]',
'value' => $storeModel->isActive(),
]
);
}
$fieldset->addField(
'store_sort_order',
'text',
Expand All @@ -125,13 +132,11 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
'disabled' => $storeModel->isReadOnly()
]
);

$fieldset->addField(
'store_is_default',
'hidden',
['name' => 'store[is_default]', 'no_span' => true, 'value' => $storeModel->getIsDefault()]
);

$fieldset->addField(
'store_store_id',
'hidden',
Expand Down
38 changes: 0 additions & 38 deletions app/code/Magento/Backend/Model/View/Layout/ConditionInterface.php

This file was deleted.

60 changes: 0 additions & 60 deletions app/code/Magento/Backend/Model/View/Layout/ConditionPool.php

This file was deleted.

52 changes: 0 additions & 52 deletions app/code/Magento/Backend/Model/View/Layout/Filter.php

This file was deleted.

Loading

0 comments on commit 59931bc

Please sign in to comment.