From f889ec2fcd7babbe246c06c3473c031954952f7b Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 9 Dec 2021 13:47:56 +0100 Subject: [PATCH] DEV: refactors admin-plugins/admin-site-settings (#15244) - drops jQuery usage - removes apparently useless clearfix - uses @action - drops unused clearFilter function in admin-plugins --- .../admin/addon/controllers/admin-plugins.js | 15 +++++++-------- .../addon/controllers/admin-site-settings.js | 18 +++++++++++------- .../admin/addon/templates/plugins.hbs | 2 -- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/admin/addon/controllers/admin-plugins.js b/app/assets/javascripts/admin/addon/controllers/admin-plugins.js index 54551537da8..be663cadb15 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-plugins.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-plugins.js @@ -1,3 +1,4 @@ +import { action } from "@ember/object"; import Controller from "@ember/controller"; import discourseComputed from "discourse-common/utils/decorators"; @@ -13,13 +14,11 @@ export default Controller.extend({ .compact(); }, - actions: { - clearFilter() { - this.setProperties({ filter: "", onlyOverridden: false }); - }, - - toggleMenu() { - $(".admin-detail").toggleClass("mobile-closed mobile-open"); - }, + @action + toggleMenu() { + const adminDetail = document.querySelector(".admin-detail"); + ["mobile-closed", "mobile-open"].forEach((state) => { + adminDetail.classList.toggle(state); + }); }, }); diff --git a/app/assets/javascripts/admin/addon/controllers/admin-site-settings.js b/app/assets/javascripts/admin/addon/controllers/admin-site-settings.js index 58859ae9335..dc5ba1193d7 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-site-settings.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-site-settings.js @@ -5,6 +5,7 @@ import { alias } from "@ember/object/computed"; import discourseDebounce from "discourse-common/lib/debounce"; import { isEmpty } from "@ember/utils"; import { observes } from "discourse-common/utils/decorators"; +import { action } from "@ember/object"; export default Controller.extend({ filter: null, @@ -126,13 +127,16 @@ export default Controller.extend({ ); }, - actions: { - clearFilter() { - this.setProperties({ filter: "", onlyOverridden: false }); - }, + @action + clearFilter() { + this.setProperties({ filter: "", onlyOverridden: false }); + }, - toggleMenu() { - $(".admin-detail").toggleClass("mobile-closed mobile-open"); - }, + @action + toggleMenu() { + const adminDetail = document.querySelector(".admin-detail"); + ["mobile-closed", "mobile-open"].forEach((state) => { + adminDetail.classList.toggle(state); + }); }, }); diff --git a/app/assets/javascripts/admin/addon/templates/plugins.hbs b/app/assets/javascripts/admin/addon/templates/plugins.hbs index 9dad110efc4..054a6d10068 100644 --- a/app/assets/javascripts/admin/addon/templates/plugins.hbs +++ b/app/assets/javascripts/admin/addon/templates/plugins.hbs @@ -26,5 +26,3 @@
{{outlet}}
- -