discourse-chat-integration/assets/javascripts/admin/components/rule-row.js.es6

41 lines
746 B
Plaintext
Raw Normal View History

import { popupAjaxError } from "discourse/lib/ajax-error";
import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
tagName: "tr",
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isCategory(type) {
return type === "normal";
2017-10-03 05:42:07 -04:00
},
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isMessage(type) {
return type === "group_message";
2017-10-03 05:42:07 -04:00
},
@computed("rule.type")
2017-10-03 05:42:07 -04:00
isMention(type) {
return type === "group_mention";
2017-10-03 05:42:07 -04:00
},
actions: {
2017-10-03 05:42:07 -04:00
edit() {
this.sendAction("edit", this.get("rule"));
},
2017-10-03 05:42:07 -04:00
delete(rule) {
rule
.destroyRecord()
.then(() => {
this.send("refresh");
})
.catch(popupAjaxError);
},
2017-10-03 05:42:07 -04:00
refresh() {
this.sendAction("refresh");
}
}
2017-10-03 05:42:07 -04:00
});