From 10e76830c4bcf351eba76bbfe241fe9ed1d63611 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 19 Sep 2011 21:06:39 +0200 Subject: [PATCH] MINOR Fixed history panel non-ajax loading and version links in "comparing X and Y" titles --- code/controllers/CMSPageHistoryController.php | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/code/controllers/CMSPageHistoryController.php b/code/controllers/CMSPageHistoryController.php index 1d83e705..6f5b9b7a 100644 --- a/code/controllers/CMSPageHistoryController.php +++ b/code/controllers/CMSPageHistoryController.php @@ -23,24 +23,32 @@ class CMSPageHistoryController extends CMSMain { /** * @return array */ - function show() { - return array( - 'EditForm' => $this->ShowVersionForm( - $this->request->param('VersionID') - ) + function show($request) { + $form = $this->ShowVersionForm( + $request->param('VersionID') ); + if($this->isAjax()) { + $content = $form->forTemplate(); + } else { + $content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show')); + } + return $content; } /** * @return array */ - function compare() { - return array( - 'EditForm' => $this->CompareVersionsForm( - $this->request->param('VersionID'), - $this->request->param('OtherVersionID') - ) + function compare($request) { + $form = $this->CompareVersionsForm( + $request->param('VersionID'), + $request->param('OtherVersionID') ); + if($this->isAjax()) { + $content = $form->forTemplate(); + } else { + $content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show')); + } + return $content; } /** @@ -92,7 +100,7 @@ class CMSPageHistoryController extends CMSMain { if($compareID) { $link = Controller::join_links( - $this->Link('version'), + $this->Link('show'), $id );