mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: category class on body was busted (:fired:)
This commit is contained in:
parent
acc12ffed1
commit
260b94e7e1
@ -2,22 +2,20 @@
|
|||||||
// add it to the body as the view is entered / left / model is changed.
|
// add it to the body as the view is entered / left / model is changed.
|
||||||
// This is used for keeping the `body` style in sync for the background image.
|
// This is used for keeping the `body` style in sync for the background image.
|
||||||
export default {
|
export default {
|
||||||
_enterView: function() { this.get('archetype'); }.on('init'),
|
_init: function() { this.get('archetype'); }.on('init'),
|
||||||
|
|
||||||
_removeClasses() {
|
_cleanUp() {
|
||||||
$('body').removeClass(function(idx, css) {
|
$('body').removeClass((_, css) => (css.match(/\barchetype-\S+/g) || []).join(' '));
|
||||||
return (css.match(/\barchetype-\S+/g) || []).join(' ');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_categoryChanged: function() {
|
_archetypeChanged: function() {
|
||||||
const archetype = this.get('archetype');
|
const archetype = this.get('archetype');
|
||||||
this._removeClasses();
|
this._cleanUp();
|
||||||
|
|
||||||
if (archetype) {
|
if (archetype) {
|
||||||
$('body').addClass('archetype-' + archetype);
|
$('body').addClass('archetype-' + archetype);
|
||||||
}
|
}
|
||||||
}.observes('archetype'),
|
}.observes('archetype'),
|
||||||
|
|
||||||
_leaveView: function() { this._removeClasses(); }.on('willDestroyElement')
|
_willDestroyElement: function() { this._cleanUp(); }.on('willDestroyElement')
|
||||||
};
|
};
|
||||||
|
@ -5,9 +5,7 @@ export default {
|
|||||||
_enterView: function() { this.get('categoryFullSlug'); }.on('init'),
|
_enterView: function() { this.get('categoryFullSlug'); }.on('init'),
|
||||||
|
|
||||||
_removeClasses() {
|
_removeClasses() {
|
||||||
$('body').removeClass(function(idx, css) {
|
$('body').removeClass((_, css) => (css.match(/\bcategory-\S+/g) || []).join(' '));
|
||||||
return (css.match(/\bcategory-\S+/g) || []).join(' ');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_categoryChanged: function() {
|
_categoryChanged: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user