DEV: drops jquery usage from discovery-categories (#15243)

This commit is contained in:
Joffrey JAFFEUX 2021-12-09 13:47:13 +01:00 committed by GitHub
parent df3886d6e5
commit 76dff7fd9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -1,19 +1,20 @@
import Component from "@ember/component";
import UrlRefresh from "discourse/mixins/url-refresh";
import { on } from "discourse-common/utils/decorators";
const CATEGORIES_LIST_BODY_CLASS = "categories-list";
export default Component.extend(UrlRefresh, {
classNames: ["contents"],
@on("didInsertElement")
addBodyClass() {
$("body").addClass(CATEGORIES_LIST_BODY_CLASS);
didInsertElement() {
this._super(...arguments);
document.body.classList.add(CATEGORIES_LIST_BODY_CLASS);
},
@on("willDestroyElement")
removeBodyClass() {
$("body").removeClass(CATEGORIES_LIST_BODY_CLASS);
willDestroyElement() {
this._super(...arguments);
document.body.classList.remove(CATEGORIES_LIST_BODY_CLASS);
},
});