ENHANCEMENT LeftAndMain->Breadcrumbs()

This commit is contained in:
Ingo Schommer 2012-02-14 16:01:26 +01:00
parent 42f3c542f8
commit 37dfbb6b7e
6 changed files with 57 additions and 5 deletions

View File

@ -501,6 +501,42 @@ class LeftAndMain extends Controller {
}
}
/**
* @return ArrayList
*/
public function Breadcrumbs($unlinked = false) {
$title = self::menu_title_for_class($this->class);
$items = new ArrayList(array(
new ArrayData(array(
'Title' => $title,
'Link' => ($unlinked) ? false : $this->Link()
))
));
$record = $this->currentPage();
if($record) {
if($record->hasExtension('Hierarchy')) {
$ancestors = $record->getAncestors();
$ancestors->push($record);
foreach($ancestors as $ancestor) {
$items->push(new ArrayData(array(
'Title' => $ancestor->Title,
'Link' => ($unlinked) ? false : Controller::join_links($this->Link('show'), $ancestor->ID)
)));
}
} else {
$items->push(new ArrayData(array(
'Title' => $record->Title,
'Link' => ($unlinked) ? false : Controller::join_links($this->Link('show'), $record->ID)
)));
}
}
// TODO Remove once ViewableData->First()/Last() is fixed
foreach($items as $i => $item) $item->iteratorProperties($i, $items->Count());
return $items;
}
/**
* @return String HTML
*/

View File

@ -231,7 +231,8 @@ body.cms { overflow: hidden; }
.cms-preview, .cms-menu, .cms-content, .cms-content-header, .cms-content-tools, .cms-content-fields, .cms-edit-form, .cms-preview, .cms-preview iframe, .cms-preview-controls { *display: inline; }
.cms-content-header { padding: 0px 8px 8px; height: 32px; z-index: 60; background-image: url(../images/textures/cms_content_header.png); background-repeat: repeat; }
.cms-content-header h2 { float: left; padding: 8px 8px 0 0; font-size: 14px; line-height: 24px; font-weight: bold; text-shadow: #bfcad2 1px 1px 0; width: 176px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; o-text-overflow: ellipsis; }
.cms-content-header a { color: #1556b2; }
.cms-content-header h2 { float: left; padding: 8px 8px 0 0; font-size: 14px; line-height: 24px; font-weight: bold; text-shadow: #bfcad2 1px 1px 0; max-width: 400px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; o-text-overflow: ellipsis; }
.cms-content-header > div { width: 9999em; overflow: hidden; }
.cms-content-header .cms-content-header-tabs { position: fixed; right: 40px; }

View File

@ -108,6 +108,10 @@ body.cms {
repeat:repeat;
}
a {
color: $color-text-blue-link;
}
h2 {
float: left;
padding: $grid-y $grid-x 0 0;
@ -115,7 +119,7 @@ body.cms {
line-height: $grid-x * 3;
font-weight: bold;
text-shadow: darken($color-widget-bg, 15%) 1px 1px 0;
width: $grid-x * 22 /* 24 - (padding on each side + margin) */;
max-width: $grid-x*50;
margin: 0;
@include hide-text-overflow();
}

View File

@ -0,0 +1,7 @@
<% control Breadcrumbs %>
<% if Last %>
<span class="crumb">$Title.XML</span>
<% else %>
<a class="crumb" href="$Link">$Title.XML</a> /
<% end_if %>
<% end_control %>

View File

@ -3,8 +3,10 @@
<% end_if %>
<div class="cms-content-header north">
<div>
<h2 id="page-title-heading" title="$Record.Breadcrumbs(20, true)">
$Record.Title
<h2 id="page-title-heading">
<% control Controller %>
<% include CMSBreadcrumbs %>
<% end_control %>
</h2>
<% if Fields.hasTabset %>
<% with Fields.fieldByName('Root') %>

View File

@ -2,7 +2,9 @@
<div class="cms-content-tools west">
<div class="cms-content-header north">
<div>
<h2><% _t('SECGROUPS','Security Groups') %></h2>
<h2>
<% include CMSBreadcrumbs %>
</h2>
</div>
</div>