plots2 icon indicating copy to clipboard operation
plots2 copied to clipboard

Improve Follow/unfollow button

Open avsingh999 opened this issue 8 years ago • 7 comments

Please describe the problem (or idea)

In user profile page if we want to follow to that user then click on follow button but after click page getting refreshing so need to add ajax here

What happened just before the problem occurred? Or what problem could this idea solve?

What did you expect to see that you didn't?

page refreshing after click on follow/unfollow button

Please show us where to look

https://publiclab.org/profile

What's your PublicLab.org username?

singhav

This can help us diagnose the issue:

Browser, version, and operating system

Many bugs are related to these -- please help us track it down and reproduce what you're seeing!


Thank you!

Your help makes Public Lab better! We deeply appreciate your helping refine and improve this site.

To learn how to write really great issues, which increases the chances they'll be resolved, see:

https://publiclab.org/wiki/developers#Contributing+for+non-coders

avsingh999 avatar Oct 02 '18 12:10 avsingh999

Yes! I checked the same on my local machine. The request to follow/unfollow is not done through AJAX. I guess it would create a better user experience. I would like to work on this, Can you help me, where should I start. I haven't work with Ajax on Rails. I have used Ajax calls in JavaScript. @avsingh999 @jywarren

ghost avatar Oct 02 '18 12:10 ghost

Can I work on this @avsingh999

roshniRam avatar Oct 02 '18 12:10 roshniRam

@Kanikashrivastav thank you for your interest, Go ahead

avsingh999 avatar Oct 02 '18 18:10 avsingh999

@Kanikashrivastav I think it would be helpfull https://github.com/publiclab/plots2/blob/1b3cd0802d5a16436602afc373f56e1ae2ade2f1/app/views/users/profile.html.erb#L155

you can get more info about profile page in this folder plots2/app/views/users/

for ajax, you can go this link https://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html

thank you

avsingh999 avatar Oct 02 '18 18:10 avsingh999

@roshniRam thank you for interest, you should move another issue because she was first for claim this issue there are other repos you can find issue and claim that issue, thank you

avsingh999 avatar Oct 02 '18 19:10 avsingh999

This is potentially a tough one! There is an example of AJAX implementation here: https://github.com/publiclab/plots2/blob/master/app/views/like/_like.html.erb

However, I think there may be quite a few more steps to complete this. Thanks!

jywarren avatar Oct 02 '18 21:10 jywarren

I would like to work on this issue. I think the following soluion could work. We current are using a form which i guess wont be useful.

  1. Instead of using a form for follow button, we could have a single button.
  2. The click event of the button is binded to a javascript function, which would make a ajax request to follow the user.
  3. We would have a new route that would in turn be handled by the create function of the relationship_controller

shubhscoder avatar Dec 26 '18 07:12 shubhscoder