A platform for community discussion. Free, open, simple.
DEV: Remove buffered rendering from admin-directory toggle
Blake Ericksone0199e80944e
diff --git a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6index f110293a745..093f29826b8 100644--- a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6+++ b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6@@ -1,36 +1,30 @@import Component from "@ember/component";import { iconHTML } from "discourse-common/lib/icon-library";-import { bufferedRender } from "discourse-common/lib/buffered-render";-export default Component.extend(- bufferedRender({- tagName: "th",- classNames: ["sortable"],- rerenderTriggers: ["order", "ascending"],-- buildBuffer(buffer) {- const icon = this.icon;-- if (icon) {- buffer.push(iconHTML(icon));- }-- buffer.push(I18n.t(this.i18nKey));-- if (this.field === this.order) {- buffer.push(iconHTML(this.ascending ? "chevron-up" : "chevron-down"));- }- },-- click() {- const currentOrder = this.order;- const field = this.field;-- if (currentOrder === field) {- this.set("ascending", this.ascending ? null : true);- } else {- this.setProperties({ order: field, ascending: null });- }+export default Component.extend({+ tagName: "th",+ classNames: ["sortable"],+ chevronIcon: null,+ toggleProperties() {+ if (this.order === this.field) {+ this.set("ascending", this.ascending ? null : true);+ } else {+ this.setProperties({ order: this.field, ascending: null });+ }+ },+ toggleChevron() {+ if (this.order === this.field) {+ let chevron = iconHTML(this.ascending ? "chevron-up" : "chevron-down");+ this.set("chevronIcon", `${chevron}`.htmlSafe());+ } else {+ this.set("chevronIcon", null);}- })-);+ },+ click() {+ this.toggleProperties();+ },+ didReceiveAttrs() {+ this._super(...arguments);+ this.toggleChevron();+ }+});diff --git a/app/assets/javascripts/admin/templates/components/admin-directory-toggle.hbs b/app/assets/javascripts/admin/templates/components/admin-directory-toggle.hbsnew file mode 100644index 00000000000..7ea697404f6--- /dev/null+++ b/app/assets/javascripts/admin/templates/components/admin-directory-toggle.hbs@@ -0,0 +1 @@+<span class="header-contents">{{i18n this.i18nKey}}{{chevronIcon}}</span>