Plugin-outlets missing post contexts (in cloaking)

(Benjamin Kampmann) #1


am onto implemeting the plugin-outlets for our internal fork of the adsense-plugin. In there we have some additional code that would show adsense after the first post, too. For which we have to add a plugin-outlet in post.js.handlebars (which we previously did using haql). But inside our connector templates we are then missing the post-data it seems. We can access the topic-controller as well as the topic-model but we can’t seem to get hold of the specific post.

This test connector

1. {{this}}
2. {{post}}
3. {{username}}
4. {{content}}
5. {{view.content}}
6. {{view}}
7. {{item}}

when added there renders to:

1. <Discourse.TopicController:ember1492> 2.  3.   4. <Discourse.Topic:ember1540>  5.   6.   7. 

even when directly pointing towards what we want through bindings at the outlet:

{{plugin-outlet "after-post" contentBinding="this" postBinding=this item=this}}

I suspect the way ember-cloaking is resetting content (and more over the controller) might be messing with it here as “this” seems to work fine outside the outlet in the post.js.handlebars. I don’t have any hard proof though.

@eviltrout any idea how to get this working? If I understand ember correctly it should always preserve the context in container-views, no?

(Robin Ward) #2

Looks like I needed to set the context appropriately. In the case of inserting a ContainerView the context of its children should have been the same of the template it’s being inserted into.

Try this out and let me know if it works for you:

(Piotr Szal) #3

It is working :slight_smile: Thx

(Jeff Atwood) #4

This topic was automatically closed after 2 days. New replies are no longer allowed.