Merge pull request #1950 from open-sausages/pulls/4.0/fix-cms-tree-reloading

BUG Prevent treeview loading repeatedly on each page edit form
This commit is contained in:
Chris Joe 2017-09-05 13:11:06 +12:00 committed by GitHub
commit eed7359526
1 changed files with 2 additions and 18 deletions

View File

@ -138,7 +138,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
private static $url_handlers = [
'EditForm/$ID' => 'EditForm',
'treeview/$ID' => 'treeview',
'listview/$ParentID' => 'listview',
];
@ -330,13 +329,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
*/
public function LinkTreeViewDeferred()
{
$link = $this->Link('treeview');
// Ensure selected page is encoded into URL
$selectedID = $this->currentPageID();
if ($selectedID) {
$link = Controller::join_links($link, $selectedID);
}
return $this->LinkWithSearch($link);
return $this->Link('treeview');
}
public function LinkPageEdit($id = null)
@ -547,11 +540,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// Get classes from object
$classes = $node->CMSTreeClasses();
// Flag as current
if ($this->isCurrentPage($node)) {
$classes .= ' current';
}
// Get status flag classes
$flags = $node->getStatusFlags();
if ($flags) {
@ -1345,14 +1333,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* This method exclusively handles deferred ajax requests to render the
* pages tree deferred handler (no pjax-fragment)
*
* @param HTTPRequest $request
* @return string HTML
*/
public function treeview($request)
public function treeview()
{
// Ensure selected page ID is highlighted
$pageID = $request->param('ID') ?: 0;
$this->setCurrentPageID($pageID);
return $this->renderWith($this->getTemplatesWithSuffix('_TreeView'));
}