Created
October 22, 2015 13:23
-
-
Save ksol/47ca393ae00054f11215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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