2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-06-15 23:03:24 +08:00
|
|
|
import DiscourseURL from "discourse/lib/url";
|
2018-02-14 04:58:32 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
classNames: ["table", "staff-actions"],
|
2018-02-14 04:58:32 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
);
|
2018-02-14 04:58:32 +08:00
|
|
|
}
|
|
|
|
});
|