mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Avoid triggering $('.cms-menu') item selection when already selected. Add new 'select' event for easier customization
This commit is contained in:
parent
e40d3d45c0
commit
475e055b18
@ -34,7 +34,10 @@
|
||||
|
||||
$('.cms-container').bind('afterstatechange', function(e, data) {
|
||||
var controller = data.xhr.getResponseHeader('X-Controller');
|
||||
if(controller) self.find('li#Menu-' + controller).select();
|
||||
if(controller) {
|
||||
var item = self.find('li#Menu-' + controller);
|
||||
if(!item.hasClass('current')) item.select();
|
||||
}
|
||||
});
|
||||
|
||||
// Sync collapsed state with parent panel
|
||||
@ -72,6 +75,8 @@
|
||||
this.siblings().removeClass('current').close();
|
||||
this.siblings().find('li').removeClass('current');
|
||||
if(parent) parent.addClass('current').siblings().removeClass('current');
|
||||
|
||||
this.trigger('select');
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user