Merge pull request #1369 from tractorcow/pulls/3.3/fix-default-home

BUG prevent "Home page" being selected when no selection was made
This commit is contained in:
Loz Calver 2016-01-20 09:11:17 +00:00
commit dbb8b5852f
3 changed files with 6 additions and 33 deletions

View File

@ -409,11 +409,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function Breadcrumbs($unlinked = false) { public function Breadcrumbs($unlinked = false) {
$items = parent::Breadcrumbs($unlinked); $items = parent::Breadcrumbs($unlinked);
// The root element should point to the pages tree view, if($items->count() > 1) {
// rather than the actual controller (which would just show an empty edit form) // Specific to the SiteTree admin section, we never show the cms section and current
$defaultTitle = self::menu_title_for_class('CMSPagesController'); // page in the same breadcrumbs block.
$items[0]->Title = _t("{$this->class}.MENUTITLE", $defaultTitle); $items->shift();
$items[0]->Link = singleton('CMSPagesController')->Link(); }
return $items; return $items;
} }
@ -869,15 +869,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$this->extend('updateCurrentPageID', $id); $this->extend('updateCurrentPageID', $id);
// Fall back to homepage record
if(!$id) {
$homepageSegment = RootURLController::get_homepage_link();
$homepageRecord = DataObject::get_one('SiteTree', array(
'"SiteTree"."URLSegment"' => $homepageSegment
));
if($homepageRecord) $id = $homepageRecord->ID;
}
return $id; return $id;
} }

View File

@ -11,10 +11,4 @@ class CMSPageEditController extends CMSMain {
private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
private static $session_namespace = 'CMSMain'; private static $session_namespace = 'CMSMain';
public function Breadcrumbs($unlinked = false) {
$crumbs = parent::Breadcrumbs($unlinked);
$crumbs[0]->Title = _t('CMSPagesController.MENUTITLE');
return $crumbs;
}
} }

View File

@ -4,19 +4,7 @@
<div class="cms-content-header-nav"> <div class="cms-content-header-nav">
<div class="breadcrumbs-wrapper" data-pjax-fragment="Breadcrumbs"> <% include CMSBreadcrumbs %>
<h2 id="page-title-heading">
<% loop $Breadcrumbs %>
<% if $First %>
<% else_if $Last %>
<span class="cms-panel-link crumb last">$Title.XML</span>
<% else %>
<a class="cms-panel-link crumb" href="$Link">$Title.XML</a>
<span class="sep">/</span>
<% end_if %>
<% end_loop %>
</h2>
</div>
<div class="cms-content-header-tabs"> <div class="cms-content-header-tabs">
<ul class="cms-tabset-nav-primary"> <ul class="cms-tabset-nav-primary">