mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX Corrected page history pane loading (fixes #7477)
This commit is contained in:
parent
e7ecdf4b35
commit
c8052da5b8
@ -21,19 +21,36 @@ class CMSPageHistoryController extends CMSMain {
|
||||
'$Action/$ID/$VersionID/$OtherVersionID' => 'handleAction'
|
||||
);
|
||||
|
||||
public function getResponseNegotiator() {
|
||||
$negotiator = parent::getResponseNegotiator();
|
||||
$controller = $this;
|
||||
$negotiator->setCallback('CurrentForm', function() use(&$controller) {
|
||||
$form = $controller->ShowVersionForm($controller->getRequest()->param('VersionID'));
|
||||
if($form) return $form->forTemplate();
|
||||
else return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
||||
});
|
||||
$negotiator->setCallback('default', function() use(&$controller) {
|
||||
return $controller->renderWith($controller->getViewer('show'));
|
||||
});
|
||||
return $negotiator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function show($request) {
|
||||
$form = $this->ShowVersionForm($request->param('VersionID'));
|
||||
|
||||
if($request->isAjax()) {
|
||||
if($form) $content = $form->forTemplate();
|
||||
else $content = $this->renderWith($this->getTemplatesWithSuffix('_Content'));
|
||||
} else {
|
||||
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
|
||||
}
|
||||
return $content;
|
||||
$negotiator = $this->getResponseNegotiator();
|
||||
$controller = $this;
|
||||
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
|
||||
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
||||
});
|
||||
$negotiator->setCallback('default', function() use(&$controller, &$form) {
|
||||
return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
|
||||
});
|
||||
|
||||
return $negotiator->respond($request);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,12 +61,17 @@ class CMSPageHistoryController extends CMSMain {
|
||||
$request->param('VersionID'),
|
||||
$request->param('OtherVersionID')
|
||||
);
|
||||
if($request->isAjax()) {
|
||||
$content = $form->forTemplate();
|
||||
} else {
|
||||
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
|
||||
}
|
||||
return $content;
|
||||
|
||||
$negotiator = $this->getResponseNegotiator();
|
||||
$controller = $this;
|
||||
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
|
||||
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
||||
});
|
||||
$negotiator->setCallback('default', function() use(&$controller, &$form) {
|
||||
return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
|
||||
});
|
||||
|
||||
return $negotiator->respond($request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@
|
||||
url = ss.i18n.sprintf(this.data('linkTmplShow'), id,to);
|
||||
}
|
||||
|
||||
$('.cms-container').loadPanel(url, '', {selector: '.cms-edit-form'});
|
||||
$('.cms-container').loadPanel(url, '', {pjax: 'CurrentForm'});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user