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
|
|
|
|
|
2015-08-19 14:55:40 +03:00
|
|
|
export default Ember.Mixin.create({
|
2014-03-04 00:18:10 +04:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|