DEV: refactors admin-plugins/admin-site-settings (#15244)

- drops jQuery usage
- removes apparently useless clearfix
- uses @action
- drops unused clearFilter function in admin-plugins
This commit is contained in:
Joffrey JAFFEUX 2021-12-09 13:47:56 +01:00 committed by GitHub
parent 5d44adb9b9
commit f889ec2fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 17 deletions

View File

@ -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);
});
},
});

View File

@ -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);
});
},
});

View File

@ -26,5 +26,3 @@
<div class="admin-detail pull-left mobile-closed">
{{outlet}}
</div>
<div class="clearfix"></div>