MINOR Avoid triggering $('.cms-menu') item selection when already selected. Add new 'select' event for easier customization

This commit is contained in:
Ingo Schommer 2011-07-15 10:36:59 +02:00
parent e40d3d45c0
commit 475e055b18

View File

@ -34,7 +34,10 @@
$('.cms-container').bind('afterstatechange', function(e, data) { $('.cms-container').bind('afterstatechange', function(e, data) {
var controller = data.xhr.getResponseHeader('X-Controller'); 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 // Sync collapsed state with parent panel
@ -72,6 +75,8 @@
this.siblings().removeClass('current').close(); this.siblings().removeClass('current').close();
this.siblings().find('li').removeClass('current'); this.siblings().find('li').removeClass('current');
if(parent) parent.addClass('current').siblings().removeClass('current'); if(parent) parent.addClass('current').siblings().removeClass('current');
this.trigger('select');
} }
}); });