Skip to content

Commit

Permalink
MINOR Avoid triggering $('.cms-menu') item selection when already sel…
Browse files Browse the repository at this point in the history
…ected. Add new 'select' event for easier customization
  • Loading branch information
chillu committed Aug 12, 2011
1 parent e40d3d4 commit 475e055
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion admin/javascript/LeftAndMain.Menu.js
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
});

Expand Down

0 comments on commit 475e055

Please sign in to comment.