mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
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:
commit
eed7359526
@ -138,7 +138,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
private static $url_handlers = [
|
private static $url_handlers = [
|
||||||
'EditForm/$ID' => 'EditForm',
|
'EditForm/$ID' => 'EditForm',
|
||||||
'treeview/$ID' => 'treeview',
|
|
||||||
'listview/$ParentID' => 'listview',
|
'listview/$ParentID' => 'listview',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -330,13 +329,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*/
|
*/
|
||||||
public function LinkTreeViewDeferred()
|
public function LinkTreeViewDeferred()
|
||||||
{
|
{
|
||||||
$link = $this->Link('treeview');
|
return $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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LinkPageEdit($id = null)
|
public function LinkPageEdit($id = null)
|
||||||
@ -547,11 +540,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
// Get classes from object
|
// Get classes from object
|
||||||
$classes = $node->CMSTreeClasses();
|
$classes = $node->CMSTreeClasses();
|
||||||
|
|
||||||
// Flag as current
|
|
||||||
if ($this->isCurrentPage($node)) {
|
|
||||||
$classes .= ' current';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get status flag classes
|
// Get status flag classes
|
||||||
$flags = $node->getStatusFlags();
|
$flags = $node->getStatusFlags();
|
||||||
if ($flags) {
|
if ($flags) {
|
||||||
@ -1345,14 +1333,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* This method exclusively handles deferred ajax requests to render the
|
* This method exclusively handles deferred ajax requests to render the
|
||||||
* pages tree deferred handler (no pjax-fragment)
|
* pages tree deferred handler (no pjax-fragment)
|
||||||
*
|
*
|
||||||
* @param HTTPRequest $request
|
|
||||||
* @return string HTML
|
* @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'));
|
return $this->renderWith($this->getTemplatesWithSuffix('_TreeView'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user