Commit 77b61671 authored by alexpott's avatar alexpott

Issue #2305807 by amitgoyal, olli | jhodgdon: Fixed Clicking "Add" filter and...

Issue #2305807 by amitgoyal, olli | jhodgdon: Fixed Clicking "Add" filter and then canceling dialog results in "You have unsaved changes.".
parent afd7cf9b
......@@ -16,12 +16,31 @@
*/
class ShowButtonsCommand implements CommandInterface {
/**
* Whether the view has been changed.
*
* @var bool
*/
protected $changed;
/**
* Constructs a \Drupal\views\Ajax\ShowButtonsCommand object.
*
* @param bool $changed
* Whether the view has been changed.
*/
public function __construct($changed) {
$this->changed = $changed;
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
*/
public function render() {
return array(
'command' => 'viewsShowButtons',
'changed' => $this->changed,
);
}
......
......@@ -13,7 +13,9 @@
Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
$('div.views-edit-view div.form-actions').removeClass('js-hide');
if (response.changed) {
$('div.views-edit-view div.view-changed.messages').removeClass('js-hide');
}
};
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
......
......@@ -161,7 +161,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
else {
$response = new AjaxResponse();
$response->addCommand(new CloseModalDialogCommand());
$response->addCommand(new Ajax\ShowButtonsCommand());
$response->addCommand(new Ajax\ShowButtonsCommand(!empty($view->changed)));
$response->addCommand(new Ajax\TriggerPreviewCommand());
if (!empty($form_state['#page_title'])) {
$response->addCommand(new Ajax\ReplaceTitleCommand($form_state['#page_title']));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment