2018-06-15 23:03:24 +08:00
|
|
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
|
|
|
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
2019-07-15 10:55:50 +08:00
|
|
|
import { escapeExpression } from "discourse/lib/utilities";
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
export default Ember.Component.extend(
|
|
|
|
bufferedRender({
|
|
|
|
classNames: ["watched-word"],
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
buildBuffer(buffer) {
|
|
|
|
buffer.push(iconHTML("times"));
|
2019-07-15 10:55:50 +08:00
|
|
|
buffer.push(` ${escapeExpression(this.get("word.word"))}`);
|
2018-06-15 23:03:24 +08:00
|
|
|
},
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
click() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.word
|
2018-06-15 23:03:24 +08:00
|
|
|
.destroy()
|
|
|
|
.then(() => {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.action(this.word);
|
2018-06-15 23:03:24 +08:00
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
bootbox.alert(
|
|
|
|
I18n.t("generic_error_with_reason", {
|
|
|
|
error: `http: ${e.status} - ${e.body}`
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|