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

30 lines
745 B
Plaintext
Raw Normal View History

2018-06-15 11:03:24 -04:00
import { iconHTML } from "discourse-common/lib/icon-library";
import { bufferedRender } from "discourse-common/lib/buffered-render";
import { escapeExpression } from "discourse/lib/utilities";
2018-06-15 11:03:24 -04:00
export default Ember.Component.extend(
bufferedRender({
classNames: ["watched-word"],
2018-06-15 11:03:24 -04:00
buildBuffer(buffer) {
buffer.push(iconHTML("times"));
buffer.push(` ${escapeExpression(this.get("word.word"))}`);
2018-06-15 11:03:24 -04:00
},
2018-06-15 11:03:24 -04:00
click() {
this.word
2018-06-15 11:03:24 -04:00
.destroy()
.then(() => {
this.action(this.word);
2018-06-15 11:03:24 -04:00
})
.catch(e => {
bootbox.alert(
I18n.t("generic_error_with_reason", {
error: `http: ${e.status} - ${e.body}`
})
);
});
}
})
);