From bb31e7f5b6150e7d30461cdeef9b537f43f3caee Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Wed, 27 Nov 2019 15:44:01 -0700 Subject: [PATCH] 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: 2673cad14280948679d1f94a977e9f868da20858 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. --- .../components/admin-watched-word.js.es6 | 47 +++++++++---------- .../components/admin-watched-word.hbs | 1 + 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 app/assets/javascripts/admin/templates/components/admin-watched-word.hbs diff --git a/app/assets/javascripts/admin/components/admin-watched-word.js.es6 b/app/assets/javascripts/admin/components/admin-watched-word.js.es6 index 8a408cf1661..8e81ee36765 100644 --- a/app/assets/javascripts/admin/components/admin-watched-word.js.es6 +++ b/app/assets/javascripts/admin/components/admin-watched-word.js.es6 @@ -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}` + }) + ); + }); + } +}); diff --git a/app/assets/javascripts/admin/templates/components/admin-watched-word.hbs b/app/assets/javascripts/admin/templates/components/admin-watched-word.hbs new file mode 100644 index 00000000000..82e6b5431c1 --- /dev/null +++ b/app/assets/javascripts/admin/templates/components/admin-watched-word.hbs @@ -0,0 +1 @@ +{{xIcon}} {{watchedWord}}