2015-02-13 05:22:32 +01:00
|
|
|
import Ember from 'ember';
|
2014-03-03 21:18:10 +01:00
|
|
|
// mixin used for routes that need to set a css className on the body tag
|
|
|
|
|
|
|
|
var styleBody = Ember.Mixin.create({
|
|
|
|
activate: function () {
|
2014-06-19 21:44:44 +02:00
|
|
|
this._super();
|
2014-10-24 23:09:50 +02:00
|
|
|
|
2014-03-03 21:18:10 +01:00
|
|
|
var cssClasses = this.get('classNames');
|
|
|
|
|
|
|
|
if (cssClasses) {
|
|
|
|
Ember.run.schedule('afterRender', null, function () {
|
|
|
|
cssClasses.forEach(function (curClass) {
|
|
|
|
Ember.$('body').addClass(curClass);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
deactivate: function () {
|
2014-06-19 21:44:44 +02:00
|
|
|
this._super();
|
2014-10-24 23:09:50 +02:00
|
|
|
|
2014-03-03 21:18:10 +01:00
|
|
|
var cssClasses = this.get('classNames');
|
|
|
|
|
|
|
|
Ember.run.schedule('afterRender', null, function () {
|
|
|
|
cssClasses.forEach(function (curClass) {
|
|
|
|
Ember.$('body').removeClass(curClass);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-24 23:09:50 +02:00
|
|
|
export default styleBody;
|