FIX: uses post widget to display topic post to allow decorateCooked (#4)

This commit is contained in:
Joffrey JAFFEUX 2019-11-26 23:27:07 +01:00 committed by Sam
parent 1c2233878f
commit 36bf06f623
2 changed files with 19 additions and 4 deletions

View File

@ -1,12 +1,22 @@
import { reads } from "@ember/object/computed";
import { computed } from "@ember/object";
export default Ember.Component.extend({
classNames: "knowledge-explorer-topic",
originalPostContent: Ember.computed.readOnly(
"topic.post_stream.posts.firstObject.cooked"
),
originalPostContent: reads("post.cooked"),
post: reads("topic.post_stream.posts.firstObject"),
model: computed("post", "topic", function() {
const post = this.post;
post.topic = this.topic;
return post;
}),
didInsertElement() {
this._super(...arguments);
document
.querySelector("body")
.classList.add("archetype-knowledge-explorer-topic");
@ -14,6 +24,7 @@ export default Ember.Component.extend({
willDestroyElement() {
this._super(...arguments);
document
.querySelector("body")
.classList.remove("archetype-knowledge-explorer-topic");

View File

@ -4,7 +4,11 @@
<div class="topic-content">
<h1>{{topic.title}}</h1>
{{{originalPostContent}}}
{{mount-widget
widget="post"
model=model
args=post
}}
</div>
<a class="knowledge-explorer-nav-link more" href="/t/{{topic.id}}">