2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-02-14 04:58:32 +08:00
|
|
|
import DiscourseURL from "discourse/lib/url";
|
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2018-02-14 04:58:32 +08:00
|
|
|
classNames: ["table", "staff-actions"],
|
|
|
|
|
|
|
|
willDestroyElement() {
|
2019-07-16 18:45:15 +08:00
|
|
|
$(this.element).off("click.discourse-staff-logs");
|
2018-02-14 04:58:32 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
didInsertElement() {
|
2019-01-19 17:05:51 +08:00
|
|
|
this._super(...arguments);
|
2018-02-14 04:58:32 +08:00
|
|
|
|
2019-07-16 18:45:15 +08:00
|
|
|
$(this.element).on(
|
|
|
|
"click.discourse-staff-logs",
|
|
|
|
"[data-link-post-id]",
|
|
|
|
(e) => {
|
|
|
|
let postId = $(e.target).attr("data-link-post-id");
|
2018-02-14 04:58:32 +08:00
|
|
|
|
2019-07-16 18:45:15 +08:00
|
|
|
this.store.find("post", postId).then((p) => {
|
|
|
|
DiscourseURL.routeTo(p.get("url"));
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
);
|
2020-07-22 02:29:02 +08:00
|
|
|
|
|
|
|
$(this.element).on(
|
|
|
|
"click.discourse-staff-logs",
|
|
|
|
"[data-link-topic-id]",
|
|
|
|
(e) => {
|
|
|
|
let topicId = $(e.target).attr("data-link-topic-id");
|
|
|
|
|
|
|
|
DiscourseURL.routeTo(`/t/${topicId}`);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
);
|
2018-02-14 04:58:32 +08:00
|
|
|
},
|
|
|
|
});
|