FIX: uses post widget to display topic post to allow decorateCooked (#4)
This commit is contained in:
parent
1c2233878f
commit
36bf06f623
|
@ -1,12 +1,22 @@
|
||||||
|
import { reads } from "@ember/object/computed";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
classNames: "knowledge-explorer-topic",
|
classNames: "knowledge-explorer-topic",
|
||||||
|
|
||||||
originalPostContent: Ember.computed.readOnly(
|
originalPostContent: reads("post.cooked"),
|
||||||
"topic.post_stream.posts.firstObject.cooked"
|
|
||||||
),
|
post: reads("topic.post_stream.posts.firstObject"),
|
||||||
|
|
||||||
|
model: computed("post", "topic", function() {
|
||||||
|
const post = this.post;
|
||||||
|
post.topic = this.topic;
|
||||||
|
return post;
|
||||||
|
}),
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelector("body")
|
.querySelector("body")
|
||||||
.classList.add("archetype-knowledge-explorer-topic");
|
.classList.add("archetype-knowledge-explorer-topic");
|
||||||
|
@ -14,6 +24,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelector("body")
|
.querySelector("body")
|
||||||
.classList.remove("archetype-knowledge-explorer-topic");
|
.classList.remove("archetype-knowledge-explorer-topic");
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
|
|
||||||
<div class="topic-content">
|
<div class="topic-content">
|
||||||
<h1>{{topic.title}}</h1>
|
<h1>{{topic.title}}</h1>
|
||||||
{{{originalPostContent}}}
|
{{mount-widget
|
||||||
|
widget="post"
|
||||||
|
model=model
|
||||||
|
args=post
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="knowledge-explorer-nav-link more" href="/t/{{topic.id}}">
|
<a class="knowledge-explorer-nav-link more" href="/t/{{topic.id}}">
|
||||||
|
|
Loading…
Reference in New Issue