discourse/app/assets/javascripts/admin/components/admin-watched-word.js.es6

30 lines
703 B
Plaintext
Raw Normal View History

import Component from "@ember/component";
2018-06-15 23:03:24 +08:00
import { iconHTML } from "discourse-common/lib/icon-library";
import { escapeExpression } from "discourse/lib/utilities";
export default Component.extend({
classNames: ["watched-word"],
watchedWord: null,
xIcon: iconHTML("times").htmlSafe(),
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}`
})
);
});
}
});