Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #21610 - No loading mask on sitemap, when click on Save #24482

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Edit.php
Expand Up @@ -6,25 +6,30 @@

namespace Magento\Sitemap\Controller\Adminhtml\Sitemap;

use Magento\Backend\App\Action\Context;
use Magento\Backend\Block\Template;
use Magento\Backend\Model\Session;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Registry;
use Magento\Sitemap\Controller\Adminhtml\Sitemap;

/**
* Controller class Edit. Responsible for rendering of a sitemap edit page
*/
class Edit extends \Magento\Sitemap\Controller\Adminhtml\Sitemap implements HttpGetActionInterface
class Edit extends Sitemap implements HttpGetActionInterface
{
/**
* Core registry
*
* @var \Magento\Framework\Registry
* @var Registry
*/
protected $_coreRegistry = null;
protected $_coreRegistry;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param Context $context
* @param Registry $coreRegistry
*/
public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry)
public function __construct(Context $context, Registry $coreRegistry)
{
$this->_coreRegistry = $coreRegistry;
parent::__construct($context);
Expand Down Expand Up @@ -53,7 +58,7 @@ public function execute()
}

// 3. Set entered data if was error when we do save
$data = $this->_objectManager->get(\Magento\Backend\Model\Session::class)->getFormData(true);
$data = $this->_objectManager->get(Session::class)->getFormData(true);
if (!empty($data)) {
$model->setData($data);
}
Expand All @@ -67,6 +72,8 @@ public function execute()
$id ? __('Edit Sitemap') : __('New Sitemap')
)->_addContent(
$this->_view->getLayout()->createBlock(\Magento\Sitemap\Block\Adminhtml\Edit::class)
)->_addJs(
$this->_view->getLayout()->createBlock(Template::class)->setTemplate('Magento_Sitemap::js.phtml')
);
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('Site Map'));
$this->_view->getPage()->getConfig()->getTitle()->prepend(
Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Sitemap/view/adminhtml/templates/js.phtml
@@ -0,0 +1,12 @@
<script>
Bartlomiejsz marked this conversation as resolved.
Show resolved Hide resolved
require(
['jquery'],
function ($) {
$(document).on('save', 'form#edit_form', function () {
if ($(this).valid()) {
$('body').trigger('processStart');
}
});
}
)
</script>