mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +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'
|
'$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
|
* @return array
|
||||||
*/
|
*/
|
||||||
function show($request) {
|
function show($request) {
|
||||||
$form = $this->ShowVersionForm($request->param('VersionID'));
|
$form = $this->ShowVersionForm($request->param('VersionID'));
|
||||||
|
|
||||||
if($request->isAjax()) {
|
$negotiator = $this->getResponseNegotiator();
|
||||||
if($form) $content = $form->forTemplate();
|
$controller = $this;
|
||||||
else $content = $this->renderWith($this->getTemplatesWithSuffix('_Content'));
|
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
|
||||||
} else {
|
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
||||||
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
|
});
|
||||||
}
|
$negotiator->setCallback('default', function() use(&$controller, &$form) {
|
||||||
return $content;
|
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('VersionID'),
|
||||||
$request->param('OtherVersionID')
|
$request->param('OtherVersionID')
|
||||||
);
|
);
|
||||||
if($request->isAjax()) {
|
|
||||||
$content = $form->forTemplate();
|
$negotiator = $this->getResponseNegotiator();
|
||||||
} else {
|
$controller = $this;
|
||||||
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
|
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
|
||||||
}
|
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
||||||
return $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);
|
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