mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
let's try category class again
This commit is contained in:
parent
a82c50d584
commit
b003c2b4f3
2 changed files with 19 additions and 23 deletions
|
@ -2,25 +2,22 @@
|
||||||
// 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 {
|
||||||
// Sam: Something about this code is messing with the "docked" class on body
|
_enterView: function() { this.get('categorySlug'); }.on('init'),
|
||||||
// it looks good, but something weird is going on.
|
|
||||||
//
|
_removeClasses: function() {
|
||||||
// _enterView: function() { this.get('categorySlug'); }.on('init'),
|
$('body').removeClass(function(idx, css) {
|
||||||
//
|
return (css.match(/\bcategory-\S+/g) || []).join(' ');
|
||||||
// _removeClasses: function() {
|
});
|
||||||
// $('body').removeClass(function(idx, css) {
|
},
|
||||||
// return (css.match(/\bcategory-[^\b]+/g) || []).join(' ');
|
|
||||||
// });
|
_categoryChanged: function() {
|
||||||
// },
|
var categorySlug = this.get('categorySlug');
|
||||||
//
|
this._removeClasses();
|
||||||
// _categoryChanged: function() {
|
|
||||||
// var categorySlug = this.get('categorySlug');
|
if (categorySlug) {
|
||||||
// this._removeClasses();
|
$('body').addClass('category-' + categorySlug);
|
||||||
//
|
}
|
||||||
// if (categorySlug) {
|
}.observes('categorySlug'),
|
||||||
// $('body').addClass('category-' + categorySlug);
|
|
||||||
// }
|
_leaveView: function() { this._removeClasses(); }.on('willDestroyElement')
|
||||||
// }.observes('categorySlug'),
|
|
||||||
//
|
|
||||||
// _leaveView: function() { this._removeClasses(); }.on('willDestroyElement')
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,7 @@ test("Visit Discovery Pages", function() {
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
ok(exists(".topic-list"), "The list of topics was rendered");
|
ok(exists(".topic-list"), "The list of topics was rendered");
|
||||||
ok(exists('.topic-list .topic-list-item'), "has topics");
|
ok(exists('.topic-list .topic-list-item'), "has topics");
|
||||||
// TODO enable test once fixed
|
ok($('body.category-bug').length, "has a custom css class for the category id on the body");
|
||||||
// ok($('body.category-bug').length, "has a custom css class for the category id on the body");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
visit("/categories");
|
visit("/categories");
|
||||||
|
|
Loading…
Reference in a new issue