Trim some unnecessary API

This commit is contained in:
Damian Mooyman 2017-12-13 14:35:21 +13:00
parent 8a04e9c46b
commit 073cb77500
2 changed files with 14 additions and 18 deletions

View File

@ -143,7 +143,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
);
private static $url_handlers = [
'EditForm/$ID' => 'EditForm'
'EditForm/$ID' => 'EditForm',
];
private static $casting = array(
@ -902,16 +902,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
);
$dateGroup->setTitle(_t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'));
// view mode
$viewMode = HiddenField::create('view', false, $this->ViewState('listview'));
// Create the Field list
$fields = new FieldList(
$content,
$pageFilter,
$pageClasses,
$dateGroup,
$viewMode
$dateGroup
);
// Create the Search and Reset action
@ -1390,26 +1386,32 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* This method exclusively handles deferred ajax requests to render the
* pages tree deferred handler (no pjax-fragment)
*
* @return string HTML
* @return DBHTMLText HTML response with the rendered treeview
*/
public function treeview()
{
return $this->renderWith($this->getTemplatesWithSuffix('_TreeView'));
}
public function listview($request)
/**
* Returns deferred listview for the current level
*
* @return DBHTMLText HTML response with the rendered listview
*/
public function listview()
{
return $this->renderWith($this->getTemplatesWithSuffix('_ListView'));
}
/**
* Get view state based on the current action
*
* @param string $default
* @return string
*/
public function ViewState($default = 'treeview')
{
$mode = $this->getRequest()->requestVar('view')
?: $this->getRequest()->param('Action');
$mode = $this->getRequest()->param('Action');
switch ($mode) {
case 'listview':
case 'treeview':
@ -1419,11 +1421,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
}
public function RequestViewState()
{
return $this->getRequest()->requestVar('view');
}
/**
* Callback to request the list of page types allowed under a given page instance.
* Provides a slower but more precise response over SiteTreeHints
@ -1508,7 +1505,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function ListViewForm()
{
$params = $this->getRequest()->requestVar('q');
// $parentID = $this->getRequest()->param('ParentID');
$parentID = $this->getRequest()->requestVar('ParentID');
$list = $this->getList($params, $parentID);
$gridFieldConfig = GridFieldConfig::create()->addComponents(

View File

@ -4,9 +4,9 @@
data-url-treeview="$LinkTreeViewDeferred"
data-url-listview="$LinkListViewDeferred"
data-url-listviewroot="$LinkListViewRoot"
data-no-ajax="<% if $TreeIsFiltered || $RequestViewState = 'listview'%>true<% else %>false<% end_if %>"
data-no-ajax="<% if $TreeIsFiltered %>true<% else %>false<% end_if %>"
>
<% if $TreeIsFiltered || $RequestViewState = 'listview' %>
<% if $TreeIsFiltered %>
<% include SilverStripe\\CMS\\Controllers\\CMSMain_ListView %>
<% else %>
<%-- Lazy-loaded via ajax --%>