mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 08:45:41 +08: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.
|
||||
// This is used for keeping the `body` style in sync for the background image.
|
||||
export default {
|
||||
_enterView: function() { this.get('archetype'); }.on('init'),
|
||||
_init: function() { this.get('archetype'); }.on('init'),
|
||||
|
||||
_removeClasses() {
|
||||
$('body').removeClass(function(idx, css) {
|
||||
return (css.match(/\barchetype-\S+/g) || []).join(' ');
|
||||
});
|
||||
_cleanUp() {
|
||||
$('body').removeClass((_, css) => (css.match(/\barchetype-\S+/g) || []).join(' '));
|
||||
},
|
||||
|
||||
_categoryChanged: function() {
|
||||
_archetypeChanged: function() {
|
||||
const archetype = this.get('archetype');
|
||||
this._removeClasses();
|
||||
this._cleanUp();
|
||||
|
||||
if (archetype) {
|
||||
$('body').addClass('archetype-' + 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'),
|
||||
|
||||
_removeClasses() {
|
||||
$('body').removeClass(function(idx, css) {
|
||||
return (css.match(/\bcategory-\S+/g) || []).join(' ');
|
||||
});
|
||||
$('body').removeClass((_, css) => (css.match(/\bcategory-\S+/g) || []).join(' '));
|
||||
},
|
||||
|
||||
_categoryChanged: function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user