DEV: Remove buffered rendering from group-index-toggle (#8399)
* DEV: Remove buffered rendering from group-index-toggle
This is the first step in a refactor to remove all uses of our Buffered
Renderer:
01e2d5a670/app/assets/javascripts/discourse-common/lib/buffered-render.js.es6 (L3)
This commit affects the header sorting on the group member and the group
requests pages. It is a refactor only with no change in functionality.
This commit is contained in:
parent
a3157f0e38
commit
d0ad5ecc6d
|
@ -1,29 +1,30 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
|
||||||
|
|
||||||
export default Component.extend(
|
export default Component.extend({
|
||||||
bufferedRender({
|
tagName: "th",
|
||||||
tagName: "th",
|
classNames: ["sortable"],
|
||||||
classNames: ["sortable"],
|
chevronIcon: null,
|
||||||
rerenderTriggers: ["order", "desc"],
|
toggleProperties() {
|
||||||
|
if (this.order === this.field) {
|
||||||
buildBuffer(buffer) {
|
this.set("desc", this.desc ? null : true);
|
||||||
buffer.push("<span class='header-contents'>");
|
} else {
|
||||||
buffer.push(I18n.t(this.i18nKey));
|
this.setProperties({ order: this.field, desc: null });
|
||||||
|
|
||||||
if (this.field === this.order) {
|
|
||||||
buffer.push(iconHTML(this.desc ? "chevron-down" : "chevron-up"));
|
|
||||||
}
|
|
||||||
buffer.push("</span>");
|
|
||||||
},
|
|
||||||
|
|
||||||
click() {
|
|
||||||
if (this.order === this.field) {
|
|
||||||
this.set("desc", this.desc ? null : true);
|
|
||||||
} else {
|
|
||||||
this.setProperties({ order: this.field, desc: null });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
);
|
toggleChevron() {
|
||||||
|
if (this.order === this.field) {
|
||||||
|
let chevron = iconHTML(this.desc ? "chevron-down" : "chevron-up");
|
||||||
|
this.set("chevronIcon", `${chevron}`.htmlSafe());
|
||||||
|
} else {
|
||||||
|
this.set("chevronIcon", null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
click() {
|
||||||
|
this.toggleProperties();
|
||||||
|
},
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.toggleChevron();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<span class="header-contents">{{i18n this.i18nKey}}{{chevronIcon}}</span>
|
Loading…
Reference in New Issue