2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-03-04 00:18:10 +04: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 23:44:44 +04:00
|
|
|
this._super();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-03-04 00:18:10 +04: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 23:44:44 +04:00
|
|
|
this._super();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-03-04 00:18:10 +04:00
|
|
|
var cssClasses = this.get('classNames');
|
|
|
|
|
|
|
|
Ember.run.schedule('afterRender', null, function () {
|
|
|
|
cssClasses.forEach(function (curClass) {
|
|
|
|
Ember.$('body').removeClass(curClass);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default styleBody;
|