DEV: Remove buffered rendering from watched words

This is another refactoring in the multi-step process to remove all uses
of our custom Render Buffer.

Previous commit: 2673cad142 in this
series.

This commit affects the display of watched words on the admin watched
word page. It is just a refactor and does not change any functionality.
This commit is contained in:
Blake Erickson 2019-11-27 15:44:01 -07:00
parent 481c8314f0
commit bb31e7f5b6
2 changed files with 24 additions and 24 deletions

View File

@ -1,30 +1,29 @@
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";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
export default Component.extend( export default Component.extend({
bufferedRender({ classNames: ["watched-word"],
classNames: ["watched-word"], watchedWord: null,
xIcon: iconHTML("times").htmlSafe(),
buildBuffer(buffer) { init() {
buffer.push(iconHTML("times")); this._super(...arguments);
buffer.push(` ${escapeExpression(this.get("word.word"))}`); this.set("watchedWord", `${escapeExpression(this.get("word.word"))}`);
}, },
click() { click() {
this.word this.word
.destroy() .destroy()
.then(() => { .then(() => {
this.action(this.word); this.action(this.word);
}) })
.catch(e => { .catch(e => {
bootbox.alert( bootbox.alert(
I18n.t("generic_error_with_reason", { I18n.t("generic_error_with_reason", {
error: `http: ${e.status} - ${e.body}` error: `http: ${e.status} - ${e.body}`
}) })
); );
}); });
} }
}) });
);

View File

@ -0,0 +1 @@
{{xIcon}} {{watchedWord}}