Add link to profile on User Map

Feature

Add link to profile on User Map

Description

A Nav Pill next to Users Map which takes the user to their profile (/my/preferences/profile).

image

Use Case

A user looks at the map (which is promoted heavily to them).

While looking at the map, they decided that they would like to put themselves on it.

To do so, they must visit their profile - which is quite buried in Discourse.

Having ready access to the link ‘just in time’ will likely markedly increase the number of users who add their address.

Budget

Hmmm. Not convinced by this.

This is not a Locations scope item.

I agree it’s buried but this is not something that should be considered in this plugin imho.

Looks like a separate job to me.

Fair point, it probably wouldn’t be helpful for all.

In our situation, we have a lot of not-very-discourse savvy folk who we are introducing the concept to. For them it could be very helpful.

In order to fork it, I can see that this is the file that sets those buttons:
https://github.com/paviliondev/discourse-locations/blob/master/assets/javascripts/discourse/connectors/users-top/map-link.hbs

Can you suggest what to put in there in order to get the button I’m after called “Profile” going to /my/preferences/profile?

@merefield - any chance you can suggest something to try? I haven’t messed with plugins before and they are a few metres deeper than I’ve been before. And harder to test when you mess with them, with greater consequences!!!

I was thinking this might work:

      <li>
        {{#link-to "preferences.profile"}}
          {{i18n 'user.profile'}}
        {{/link-to}}
      </li>

I’m very keen to have this in the context of the User list / map. My workaround will of course just have a prominent Profile button in the header, but that will clutter things up quite a bit.

Thank you!

Hi Nathan, I think you may need to provide the link-to helper with a user object so it knows which profile …

https://guides.emberjs.com/v2.5.0/templates/links/

The next challenge you may have is that the user object doesn’t exist in that route’s model …

Darn it! That looks horribly complicated and way beyond my simple hacking.

The thing is that a simple url would do the trick if I just knew how to get it in there!!!

/my/preferences/profile

Oh that’s interesting. That link actually works. I was expecting it to require a genuine user id but apparently not!!

Yeah, it is clever trick that Discourse has had for ages but takes a while to stumble across!

Any idea how I’d drop that in the code to make it work?

Sorry no time to look at this atm, Nathan, apologies

Definitely try to reverse engineer it using existing plugin and Theme Component eco-system for existing examples.

Well, success! Once it tweaked that I could just insert any old html in there I was away. But it turned out that I was looking at the wrong file. The one above refers to the /u page, and I had to hack this one here instead.

Here is my forked version:
https://github.com/nathan-nz/discourse-locations/blob/master/assets/javascripts/discourse/templates/users/user-map.hbs

And the result:

image

Awesome, well done Nathan!

We are accepting applications for Pavilion btw :wink: