API CHANGE Removed support for CMSTopMenu_alternative template, use CMSMenu.ss in themes or project template folders instead

API CHANGE Renamed LeftAndMain->CMSTopMenu() to CMSMenu()
API CHANGE Renamed LeftAndMain->Left() to Menu(), used through LeftAndMain_Menu.ss templates (instead of LeftAndMain_left.ss) - in order to avoid presentational naming
API CHANGE Renamed LeftAndMain->Right() to Content(), used through LeftAndMain_Content.ss templates (instead of LeftAndMain_right.ss) - in order to avoid presentational naming
This commit is contained in:
Ingo Schommer 2011-04-15 14:12:57 +12:00
parent 99a68dde75
commit 9da43d139a
5 changed files with 66 additions and 43 deletions

View File

@ -392,7 +392,9 @@ class LeftAndMain extends Controller {
$linkingmode = "";
if(strpos($this->Link(), $menuItem->url) !== false) {
if($menuItem->controller && $this instanceof $menuItem->controller) {
$linkingmode = "current";
} else if(strpos($this->Link(), $menuItem->url) !== false) {
if($this->Link() == $menuItem->url) {
$linkingmode = "current";
@ -430,8 +432,8 @@ class LeftAndMain extends Controller {
return $menu;
}
public function CMSTopMenu() {
return $this->renderWith(array('CMSTopMenu_alternative','CMSTopMenu'));
public function Menu() {
return $this->renderWith($this->getTemplatesWithSuffix('_Menu'));
}
/**
@ -446,12 +448,8 @@ class LeftAndMain extends Controller {
return $templates;
}
public function Left() {
return $this->renderWith($this->getTemplatesWithSuffix('_left'));
}
public function Right() {
return $this->renderWith($this->getTemplatesWithSuffix('_right'));
public function Content() {
return $this->renderWith($this->getTemplatesWithSuffix('_Content'));
}
public function getRecord($id) {
@ -1067,6 +1065,13 @@ class LeftAndMain extends Controller {
return $nav['items'];
}
}
/**
* @return SiteConfig
*/
function SiteConfig() {
return SiteConfig::current_site_config();
}
/**
* The application name. Customisable by calling

View File

@ -1,31 +0,0 @@
<div class="cms-logo">
<a href="http://www.silverstripe.org/" target="_blank">
SilverStripe <% if CMSVersion %><abbr class="version">$CMSVersion</abbr><% end_if %>
</a>
</div>
<div class="cms-login-status">
<a href="Security/logout" class="logout-link"><% _t('LOGOUT','Log out') %></a>
<% control CurrentMember %>
<% _t('Hello','Hi') %>
<strong>
<a href="{$AbsoluteBaseURL}admin/myprofile" class="profile-link">
<% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %>
</a>
</strong>
<% end_control %>
</div>
<ul class="cms-menu-list">
<% control MainMenu %>
<li class="$LinkingMode" id="Menu-$Code">
<a href="$Link">$Title</a>
<% if Title == 'Edit Page' %>
<ul>
<li class="current"><a href="#">Content</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Reports</a></li>
<li><a href="#">History</a></li>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul>

View File

@ -0,0 +1 @@
$EditForm

View File

@ -0,0 +1,50 @@
<div class="cms-menu west">
<div class="cms-header">
<div class="cms-logo">
<a href="http://www.silverstripe.org/" target="_blank">
SilverStripe <% if CMSVersion %><abbr class="version">$CMSVersion</abbr><% end_if %>
</a>
<span>$SiteConfig.Title</span>
</div>
<div class="cms-login-status">
<a href="Security/logout" class="logout-link"><% _t('LOGOUT','Log out') %></a>
<% control CurrentMember %>
<% _t('Hello','Hi') %>
<strong>
<a href="{$AbsoluteBaseURL}admin/myprofile" class="profile-link">
<% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %>
</a>
</strong>
<% end_control %>
</div>
</div>
<ul class="cms-menu-list">
<% control MainMenu %>
<li class="$LinkingMode" id="Menu-$Code">
<a href="$Link">
<span class="icon">&nbsp;</span>
<span class="text">$Title</span>
</a>
<% if Code == 'CMSMain' && LinkingMode == 'current' %>
<ul>
<li <% if Top.class == 'CMSPageEditController' %>class="current"<% end_if %>><a href="admin/page/edit/show/$Top.CurrentPageID">
<span class="text">Content</span>
</a></li>
<li <% if Top.class == 'CMSPageSettingsController' %>class="current"<% end_if %>><a href="admin/page/settings/show/$Top.CurrentPageID">
<span class="text">Settings</span>
</a></li>
<li <% if Top.class == 'CMSPageReportsController' %>class="current"<% end_if %>><a href="#">
<span class="text">Reports</span>
</a></li>
<li <% if Top.class == 'CMSPageHistoryController' %>class="current"<% end_if %>><a href="#">
<span class="text">History</span>
</a></li>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul>
</div>

View File

@ -13,9 +13,7 @@
<div class="cms-container {layout: {type: 'border'}}">
<div class="cms-menu west">
$CMSTopMenu
</div>
$Menu
<div class="cms-content center {layout: {type: 'border'}}" id="right">