These are chat archives for ushahidi/Community

24th
Aug 2017
azizfall
@azizfall
Aug 24 2017 17:11
Dear ushahidi members there are two things I want to do on the client server that I have not yet figured out
  1. under localhost:3000/views/map there is this yellow post button with class = "button-alpha button-fab" that I want to get rid of in the map view but I cant seem to find the html code to delete the button
  1. I am unsure as to how the post object is instanstiated on the client side
azizfall
@azizfall
Aug 24 2017 17:16
like for example post.user, is a local json object saved on the client side from making an API request to the api_server, I am asking this because I want to change the gravatar that appears in the map view for users by adding a form_attribute along with the post json request of the users gravatar url, then somehow change that on the client side, but I cant seem to find the source code or where the code is I need to change to accomplish this
does anyone have any ideas
@rowasc I would very much appreciate if you could help me with this task
or @ushbot
azizfall
@azizfall
Aug 24 2017 18:04
I also want to destroy the button under list view as well as the map view
Romina Suarez
@rowasc
Aug 24 2017 19:19
Hi Aziz, I'm going to check this when I get off work in a couple of hours and get back to you
azizfall
@azizfall
Aug 24 2017 19:34
thank you so much Romina I appreciate it
Romina Suarez
@rowasc
Aug 24 2017 21:40

ok , my long weekend is officially ON :fire: wohoo :sparkles:

so, the post button is a directive being called from post-toolbar.html ( <add-post-button></add-post-button> )

Romina Suarez
@rowasc
Aug 24 2017 22:13

I don't get exactly what you want to do with the user post gravatar :/ if it helps: the post data is coming from a get request that is done using the post-endpoint.js file, and in turn the getPostDetail function in the post-view-map-directive.js file is the one called when you click on that map marker ...

BUT, if you look at the card.html file in the post views , you will notice that the gravatar is being displayed in the post-metadata directive (specifically it's used in the template app/main/posts/common/post-metadata.html) . And then if you go there to the directive js code, you can see that post.user is assigned like this: $scope.post.user = PostMetadataService.loadUser($scope.post);

feel free to @ me if you come back and want to discuss this in more detail, I'll probably be around for a couple of hours
azizfall
@azizfall
Aug 24 2017 22:51
thanks Romina that was very helpful I was able to get rid of the button
and change the gravatar by changing d=retro in line 15 of post-metadata.html with d=url_encoded(image_url),
Romina Suarez
@rowasc
Aug 24 2017 22:53
ha! cool .
azizfall
@azizfall
Aug 24 2017 22:53
but what I want to do is in the post
request add an attribute values { "gravatar_url": "image_url"}
and then somehow change the gravatar by doing post.values.gravatar_url
but I am not sure how values{} from the json post request is stored in the post object, and when I make a form attribute using the API it hashes the key in values{key: val} so that the key starts with a number
so I dont think post.values.(key that starts with a number) will work
do you have any ideas on this? @rowasc
azizfall
@azizfall
Aug 24 2017 22:58
thanks again for your patience and help
Romina Suarez
@rowasc
Aug 24 2017 23:04

ohh I think I know what you mean. I saw key names for attributes like that last time I checked that part of the BD/codebase on attributes. Give me a few minutes and i'll come back with something useful, hopefully.

Also, you can access post.values['1234key'] (any key used with square bracket notation) and it will work fine.

Romina Suarez
@rowasc
Aug 24 2017 23:23
@azizfall so just to validate, you get getting something like de3b8b29-dbe8-4941-8017-0c6896428b70 in you values array , right?
azizfall
@azizfall
Aug 24 2017 23:24
yeah
but my key starts with a number
Romina Suarez
@rowasc
Aug 24 2017 23:25
ok good.
azizfall
@azizfall
Aug 24 2017 23:25
d=post.values['147b3ff7-b1e4-8db0-bcb7-fc3cc018ff93']
does not seem to work
when I make the change in post-metadata.html
wait hold on I messed up
well I am try again in a few hours
I have to go somewhere now, but I appreciate the help
Romina Suarez
@rowasc
Aug 24 2017 23:31
that's alright. Let me know if you figure this out , if not, I'll be around tomorrow . :thumbsup:
azizfall
@azizfall
Aug 24 2017 23:32
ok thanks !!