Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT LeftAndMain->Breadcrumbs()

  • Loading branch information...
commit 37dfbb6b7e0a8949f3dda3b7299333037e7451db 1 parent 42f3c54
@chillu chillu authored
View
36 admin/code/LeftAndMain.php
@@ -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
3  admin/css/screen.css
@@ -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
6 admin/scss/_style.scss
@@ -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();
}
View
7 admin/templates/CMSBreadcrumbs.ss
@@ -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
6 admin/templates/Includes/LeftAndMain_EditForm.ss
@@ -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
4 admin/templates/Includes/SecurityAdmin_Content.ss
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.