mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Simplified ajax/non-ajax responses in CMS. Browsers handle 3xx Ajax responses transparently, so a CMS redirect (and some smartness in the JS state handling) is enough, no conditionals required.
This commit is contained in:
parent
a097266ded
commit
3248da02ce
@ -407,9 +407,7 @@ JS
|
|||||||
mkdir($record->FullPath);
|
mkdir($record->FullPath);
|
||||||
chmod($record->FullPath, Filesystem::$file_create_mask);
|
chmod($record->FullPath, Filesystem::$file_create_mask);
|
||||||
|
|
||||||
$link = Controller::join_links($this->Link('show'), $parentRecord->ID);
|
return $this->redirect(Controller::join_links($this->Link('show'), $parentRecord->ID));
|
||||||
$this->getResponse()->addHeader('X-ControllerURL', $link);
|
|
||||||
return $this->redirect($link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,14 +126,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
$editController = singleton('CMSPageEditController');
|
$editController = singleton('CMSPageEditController');
|
||||||
$editController->setCurrentPageID($record->ID);
|
$editController->setCurrentPageID($record->ID);
|
||||||
|
|
||||||
$link = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID);
|
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
|
||||||
$this->getResponse()->addHeader('X-ControllerURL', $link);
|
|
||||||
|
|
||||||
if(Director::is_ajax()) {
|
|
||||||
return $editController->renderWith(array_pop($editController->getTemplatesWithSuffix('_Content')));
|
|
||||||
} else {
|
|
||||||
return $this->redirect($link);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user