Permalink
Browse files

ENHANCEMENT LeftAndMain->Breadcrumbs()

  • Loading branch information...
1 parent 42f3c54 commit 37dfbb6b7e0a8949f3dda3b7299333037e7451db @chillu chillu committed Feb 14, 2012
View
@@ -500,6 +500,42 @@ public function getRecord($id) {
return false;
}
}
+
+ /**
+ * @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

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -107,6 +107,10 @@ body.cms {
image:url(../images/textures/cms_content_header.png);
repeat:repeat;
}
+
+ a {
+ color: $color-text-blue-link;
+ }
h2 {
float: left;
@@ -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();
}
@@ -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 %>
@@ -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') %>
@@ -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>

0 comments on commit 37dfbb6

Please sign in to comment.