Improve Follow/unfollow button
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
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
Can I work on this @avsingh999
@Kanikashrivastav thank you for your interest, Go ahead
@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
@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
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!
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.
- Instead of using a form for follow button, we could have a single button.
- The click event of the button is binded to a javascript function, which would make a ajax request to follow the user.
- We would have a new route that would in turn be handled by the create function of the relationship_controller