Dynamic Templates for plugin-outlet UIs


(mandar) #1

Hi All

I am trying to extend the discourse UI by leveraging the plugin-outlets. Currently trying to add a custom header on top of the discourse header by leveraging ‘above-site-header’ plugin-outlet. I would like to make this template dynamic based on the logged in user. I am not able to figure out which ember controller backs up the plugin-outlet templates. I would really appreciate if someone could point me in the right direction on this one. (I tried ApplicationController as the outlet sits in application.hbs, but no luck).

Thanks
Mandar


(Robin Ward) #2

As of our latest stable release, outlets can only receive access to the parameters passed into them, so you can’t access controller methods.

Instead you should use a connector class for your outlet. Additionally, you could just create a new ember component and use it in your connector – it should have this.currentUser to know about the current person who is logged in.

Taking it a step further, just in your template you should be able to say {{currentUser.username}} and find out things about your user in there too.


(mandar) #3

Hi Robin - Thanks so much for the quick reply. I will checkout the connector class.

Regards
Mandar


(Robin Ward) #4