Okay, I am really struggling to understand what is going. I know I am missing something obvious but at this point it is like black magic.
I tried reopen() on FlaggedPost and I know my code is getting called because if I have an error then there is a javascript error until I fix it but I can’t get access to my code from the template.
Here is my /assets/javascripts/admin/models/flagged-post.js.es6. I ended up just throwing everything at the wall to try to get something to show, never mind trying to get my custom field to show. I have tried reopen() and reopenClass() to see if that makes a difference:
import flaggedPost from 'admin/models/flagged-post';
import computed from 'ember-addons/ember-computed-decorators';
console.log('loaded');
flaggedPost.reopenClass({
@computed
test_response_1() {
return true;
},
test_response_2() {
return true;
},
@computed
test_response_3: true,
test_response_4: true,
});
and my /assets/javascripts/discourse/templates/connectors/flagged-post-below-controls/test_template.hbs:
<div >
Stuff will show here
<div>
blah
post: {{flaggedPost}}
log: {{log flaggedPost}}
blah
</div>
<div>
test_response_1: {{flaggedPost.test_response_1}}
log test_response_1: {{log flaggedPost.test_response_1}}
</div>
<div>
{{#if flaggedPost.test_response_1}}
True
{{else}}
False
{{/if}}
</div>
<div>
{{#if flaggedPost.test_response_2}}
True
{{else}}
False
{{/if}}
</div>
<div>
{{#if flaggedPost.test_response_3}}
True
{{else}}
False
{{/if}}
</div>
<div>
{{#if flaggedPost.test_response_4}}
True
{{else}}
False
{{/if}}
</div>
</div>
but all that shows is:
Stuff will show here
blah post: <(unknown mixin):ember1113> log: blah
test_response_1: log test_response_1:
False
False
False
False
I need some help to point me in the right direction, as I am completely lost here.
Thanks!