I’m using the user-profile-primary
plugin outlet to add some things to the user pages.
In the .hbs template, I want some things to be conditional on whether the displayed user is the logged on user or someone else. This is done via a computed viewingSelf
property in the internal templates, but it’s not available directly from the user model.
From Important changes to Plugin Outlets for Ember 2.10 I can see that the child template no longer automatically inherits everything the parent template could use, and since viewingSelf is a computed property it looks like it is one of the missing things.
I also see in there that I can make a connector, and add whatever I need, so I’m trying something like this, just trying to get it so {{newTestThing}} will print the two usernames first:
export default {
setupComponent(args, component) {
const modelUser = args.model.get("username");
const activeUser = ???;
component.set('newTestThing', modelUser + " --?-- " + activeUser);
}
}
I can’t work out what should go into ??? though.
currentUser
, application
, etc. don’t seem to exist on this
or on any of the objects contained in args
(at least from trying various combinations, then setting a breakpoint and looking around in Chrome’s js debugger). [EDIT: This statement is wrong. this.currentUser
works fine. See a few posts down.]
I’m probably missing something simple, but can’t see the wood for the trees at the moment. Any help much appreciated!
(I’m not tied to this method of doing things, either. If there’s an easier way to say {{#if viewingSelf}}
inside the user-profile-primary
outlet then that’s my real goal.)