mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT LeftAndMain->Breadcrumbs()
This commit is contained in:
parent
42f3c542f8
commit
37dfbb6b7e
@ -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
|
* @return String HTML
|
||||||
*/
|
*/
|
||||||
|
@ -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-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 { 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 > div { width: 9999em; overflow: hidden; }
|
||||||
.cms-content-header .cms-content-header-tabs { position: fixed; right: 40px; }
|
.cms-content-header .cms-content-header-tabs { position: fixed; right: 40px; }
|
||||||
|
|
||||||
|
@ -108,6 +108,10 @@ body.cms {
|
|||||||
repeat:repeat;
|
repeat:repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $color-text-blue-link;
|
||||||
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
float: left;
|
float: left;
|
||||||
padding: $grid-y $grid-x 0 0;
|
padding: $grid-y $grid-x 0 0;
|
||||||
@ -115,7 +119,7 @@ body.cms {
|
|||||||
line-height: $grid-x * 3;
|
line-height: $grid-x * 3;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-shadow: darken($color-widget-bg, 15%) 1px 1px 0;
|
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;
|
margin: 0;
|
||||||
@include hide-text-overflow();
|
@include hide-text-overflow();
|
||||||
}
|
}
|
||||||
|
7
admin/templates/CMSBreadcrumbs.ss
Normal file
7
admin/templates/CMSBreadcrumbs.ss
Normal 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 %>
|
@ -3,8 +3,10 @@
|
|||||||
<% end_if %>
|
<% end_if %>
|
||||||
<div class="cms-content-header north">
|
<div class="cms-content-header north">
|
||||||
<div>
|
<div>
|
||||||
<h2 id="page-title-heading" title="$Record.Breadcrumbs(20, true)">
|
<h2 id="page-title-heading">
|
||||||
$Record.Title
|
<% control Controller %>
|
||||||
|
<% include CMSBreadcrumbs %>
|
||||||
|
<% end_control %>
|
||||||
</h2>
|
</h2>
|
||||||
<% if Fields.hasTabset %>
|
<% if Fields.hasTabset %>
|
||||||
<% with Fields.fieldByName('Root') %>
|
<% with Fields.fieldByName('Root') %>
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
<div class="cms-content-tools west">
|
<div class="cms-content-tools west">
|
||||||
<div class="cms-content-header north">
|
<div class="cms-content-header north">
|
||||||
<div>
|
<div>
|
||||||
<h2><% _t('SECGROUPS','Security Groups') %></h2>
|
<h2>
|
||||||
|
<% include CMSBreadcrumbs %>
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user