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

View File

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