mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: update admin menu links when current page ID updates. Fixes #6768.
This commit is contained in:
parent
45c25e93b4
commit
a04c1410e1
@ -54,7 +54,21 @@
|
||||
updateItems: function() {
|
||||
// Hide "edit page" commands unless the section is activated
|
||||
var editPageItem = this.find('#Menu-CMSMain');
|
||||
|
||||
editPageItem[editPageItem.is('.current') ? 'show' : 'hide']();
|
||||
|
||||
// update the menu links to reflect the page ID if the page has changed the URL.
|
||||
var currentID = $('.cms-content input[name=ID]').val();
|
||||
|
||||
// only handling the sub menu as the other items are global in context
|
||||
if(currentID) {
|
||||
$(this).find("ul a").each(function(i, elem) {
|
||||
var href = $(elem).attr("href").split('/');
|
||||
href[href.length -1] = currentID;
|
||||
|
||||
$(elem).attr('href', href.join('/'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -31,15 +31,21 @@
|
||||
|
||||
<% if Code == 'CMSMain' %>
|
||||
<ul>
|
||||
<li class="first <% if Top.class == 'CMSPageEditController' || Top.class == 'CMSMain' %>current<% end_if %>" id="Menu-CMSPageEditController"><a href="admin/page/edit/show/$Top.CurrentPageID">
|
||||
<span class="text">Content</span>
|
||||
</a></li>
|
||||
<li <% if Top.class == 'CMSPageSettingsController' %>class="current"<% end_if %> id="Menu-CMSPageSettingsController"><a href="admin/page/settings/show/$Top.CurrentPageID">
|
||||
<span class="text">Settings</span>
|
||||
</a></li>
|
||||
<li <% if Top.class == 'CMSPageHistoryController' %>class="current"<% end_if %> id="Menu-CMSPageHistoryController"><a href="admin/page/history/show/$Top.CurrentPageID">
|
||||
<span class="text">History</span>
|
||||
</a></li>
|
||||
<li class="first <% if Top.class == 'CMSPageEditController' || Top.class == 'CMSMain' %>current<% end_if %>" id="Menu-CMSPageEditController">
|
||||
<a href="admin/page/edit/show/$Top.CurrentPageID">
|
||||
<span class="text">Content</span>
|
||||
</a>
|
||||
</li>
|
||||
<li <% if Top.class == 'CMSPageSettingsController' %>class="current"<% end_if %> id="Menu-CMSPageSettingsController">
|
||||
<a href="admin/page/settings/show/$Top.CurrentPageID">
|
||||
<span class="text">Settings</span>
|
||||
</a>
|
||||
</li>
|
||||
<li <% if Top.class == 'CMSPageHistoryController' %>class="current"<% end_if %> id="Menu-CMSPageHistoryController">
|
||||
<a href="admin/page/history/show/$Top.CurrentPageID">
|
||||
<span class="text">History</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% end_if %>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user