Skip to content

Instantly share code, notes, and snippets.

@ksol
Created October 22, 2015 13:23
Show Gist options
  • Save ksol/47ca393ae00054f11215 to your computer and use it in GitHub Desktop.
Save ksol/47ca393ae00054f11215 to your computer and use it in GitHub Desktop.
Ember.Route.reopen({
activate: function() {
var cssClass = this.toCssClass();
// you probably don't need the application class
// to be added to the body
if (cssClass !== 'application') {
Ember.$('body').addClass(cssClass);
}
},
deactivate: function() {
Ember.$('body').removeClass(this.toCssClass());
},
toCssClass: function() {
return this.routeName.replace(/\./g, '-').dasherize();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment