Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…6768.
  • Loading branch information...
commit a04c1410e14711e5ff23aaa5fbecfdda545e86c9 1 parent 45c25e9
@wilr wilr authored
View
14 admin/javascript/LeftAndMain.Menu.js
@@ -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
24 admin/templates/Includes/LeftAndMain_Menu.ss
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.