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:
Ingo Schommer 2012-03-12 13:45:10 +01:00
parent a097266ded
commit 3248da02ce
2 changed files with 2 additions and 11 deletions

View File

@ -407,9 +407,7 @@ JS
mkdir($record->FullPath);
chmod($record->FullPath, Filesystem::$file_create_mask);
$link = Controller::join_links($this->Link('show'), $parentRecord->ID);
$this->getResponse()->addHeader('X-ControllerURL', $link);
return $this->redirect($link);
return $this->redirect(Controller::join_links($this->Link('show'), $parentRecord->ID));
}
/**

View File

@ -126,14 +126,7 @@ class CMSPageAddController extends CMSPageEditController {
$editController = singleton('CMSPageEditController');
$editController->setCurrentPageID($record->ID);
$link = 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);
}
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
}
}