mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
@a2nt non-ajax loading fix for bulkEditing
This commit is contained in:
parent
d6ea450ffc
commit
cdbf3708a0
@ -151,7 +151,33 @@ class GridFieldBulkManager_Request extends RequestHandler {
|
||||
$response = new SS_HTTPResponse($formHTML);
|
||||
$response->addHeader('Content-Type', 'text/plain');
|
||||
$response->addHeader('X-Title', 'SilverStripe - Bulk '.$this->gridField->list->dataClass.' Editing');
|
||||
return $response;
|
||||
|
||||
if($request->isAjax())
|
||||
{
|
||||
return $response;
|
||||
}
|
||||
else {
|
||||
$controller = $this->getToplevelController();
|
||||
// If not requested by ajax, we need to render it within the controller context+template
|
||||
return $controller->customise(array(
|
||||
'Content' => $response->getBody(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverse up nested requests until we reach the first that's not a GridFieldDetailForm or GridFieldDetailForm_ItemRequest.
|
||||
* The opposite of {@link Controller::curr()}, required because
|
||||
* Controller::$controller_stack is not directly accessible.
|
||||
*
|
||||
* @return Controller
|
||||
*/
|
||||
protected function getToplevelController() {
|
||||
$c = $this->controller;
|
||||
while($c && ($c instanceof GridFieldDetailForm_ItemRequest || $c instanceof GridFieldDetailForm)) {
|
||||
$c = $c->getController();
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user