framework/ember/app/mixins/add-css-class-to-body.js

16 lines
351 B
JavaScript

import Ember from 'ember';
export default Ember.Mixin.create({
activate: function() {
var cssClass = this.toCssClass();
Ember.$('body').addClass(cssClass);
},
deactivate: function() {
Ember.$('body').removeClass(this.toCssClass());
},
toCssClass: function() {
return this.routeName.replace(/\./g, '-').dasherize();
}
});