mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX Ensure tab states are reflected when switching on page edit screen
This commit is contained in:
parent
732bdd2734
commit
dd4d5740b8
@ -350,6 +350,21 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide which is the active primary tab in a CMS edit screen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getActiveTab()
|
||||
{
|
||||
if ($this instanceof CMSPageSettingsController) {
|
||||
return 'settings';
|
||||
} elseif ($this instanceof CMSPageHistoryController) {
|
||||
return 'history';
|
||||
}
|
||||
return 'edit';
|
||||
}
|
||||
|
||||
public function LinkWithSearch($link)
|
||||
{
|
||||
// Whitelist to avoid side effects
|
||||
|
@ -10,17 +10,17 @@
|
||||
|
||||
<div class="cms-content-header-tabs cms-tabset">
|
||||
<ul class="cms-tabset-nav-primary nav nav-tabs">
|
||||
<li class="nav-item content-treeview<% if $class == 'SilverStripe\\CMS\\Controllers\\CMSPageEditController' %> ui-tabs-active<% end_if %>">
|
||||
<li class="nav-item content-treeview<% if $ActiveTab == 'edit' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageEdit" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageEdit">
|
||||
<% _t('SilverStripe\CMS\Controllers\CMSMain.TabContent', 'Content') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $class == 'SilverStripe\\CMS\\Controllers\\CMSPageSettingsController' %> ui-tabs-active<% end_if %>">
|
||||
<li class="nav-item content-listview<% if $ActiveTab == 'settings' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageSettings" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageSettings">
|
||||
<% _t('SilverStripe\CMS\Controllers\CMSMain.TabSettings', 'Settings') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $class == 'SilverStripe\\CMS\\Controllers\\CMSPageHistoryController' %> ui-tabs-active<% end_if %>">
|
||||
<li class="nav-item content-listview<% if $ActiveTab == 'history' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageHistory" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageHistory">
|
||||
<% _t('SilverStripe\CMS\Controllers\CMSMain.TabHistory', 'History') %>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user