BUGFIX: update admin menu links when current page ID updates. Fixes #6768.

This commit is contained in:
Will Rossiter 2011-12-17 15:48:47 +13:00
parent 45c25e93b4
commit a04c1410e1
2 changed files with 29 additions and 9 deletions

View File

@ -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('/'));
});
}
}
});

View File

@ -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>