mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FEATURE: add 'navigation-categories' class on 'body' when visiting /categories
This commit is contained in:
parent
3c2486e2ba
commit
5f33a81b1c
3 changed files with 28 additions and 8 deletions
|
@ -1,11 +1,16 @@
|
|||
import UrlRefresh from 'discourse/mixins/url-refresh';
|
||||
import { on } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
const CATEGORIES_LIST_BODY_CLASS = "categories-list";
|
||||
|
||||
export default Ember.View.extend(UrlRefresh, {
|
||||
_addBodyClass: function() {
|
||||
$('body').addClass('categories-list');
|
||||
}.on('didInsertElement'),
|
||||
@on("didInsertElement")
|
||||
addBodyClass() {
|
||||
$('body').addClass(CATEGORIES_LIST_BODY_CLASS);
|
||||
},
|
||||
|
||||
_removeBodyClass: function() {
|
||||
$('body').removeClass('categories-list');
|
||||
}.on('willDestroyElement')
|
||||
@on("willDestroyElement")
|
||||
removeBodyClass() {
|
||||
$('body').removeClass(CATEGORIES_LIST_BODY_CLASS);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { on } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
const CATEGORIES_BODY_CLASS = "navigation-categories";
|
||||
|
||||
export default Ember.View.extend({
|
||||
@on("didInsertElement")
|
||||
addBodyClass() {
|
||||
$('body').addClass(CATEGORIES_BODY_CLASS);
|
||||
},
|
||||
|
||||
@on("willDestroyElement")
|
||||
removeBodyClass() {
|
||||
$('body').removeClass(CATEGORIES_BODY_CLASS);
|
||||
},
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
import AddCategoryClass from 'discourse/mixins/add-category-class';
|
||||
|
||||
export default Em.View.extend(AddCategoryClass, {
|
||||
categoryFullSlug: Em.computed.alias('controller.category.fullSlug')
|
||||
export default Ember.View.extend(AddCategoryClass, {
|
||||
categoryFullSlug: Ember.computed.alias('controller.category.fullSlug')
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue