publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
959 stars 1.84k forks source link

Unsubscribe button does'nt work #7508

Closed sssash18 closed 3 years ago

sssash18 commented 4 years ago

Please describe the problem (or idea)

What happened just before the problem occurred? Or what problem could this idea solve? Unsubscribe button in dropdown does not actually unsubscribes a user Current Behaviour Untitled_ Feb 16, 2020 12_23 AM

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

Please show us where to look

https://publiclab.org/ ...

What's your PublicLab.org username?

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

NitinBhasneria commented 4 years ago

@sssash18 are you working on this?

sssash18 commented 4 years ago

@NitinBhasneria if you want , you can work on it.Thanks

NitinBhasneria commented 4 years ago

Ok will be working on it.

NitinBhasneria commented 4 years ago

https://github.com/publiclab/plots2/blob/8d2efcb96e9643a74957d5cdde208f21d01360fb/app/views/tag/show/_user_controls.html.erb#L9-L12 this is the code @nstjean @cesswairimu do you find any error in this?

cesswairimu commented 4 years ago

Yeah..I think the problem here is its doing a GET instead of a delete try adding data-method="delete"

NitinBhasneria commented 4 years ago

@cesswairimu actually I have already tried adding data-method="delete" but nothing happened

cesswairimu commented 4 years ago

oh :thinking: ,maybe we can try rails link...using <%= link_to ......... method: :delete %>?

NitinBhasneria commented 4 years ago

No, @cesswairimu It is working same with this... as <a ....

cesswairimu commented 4 years ago

okay, I will take a closer look at it later and let you know if any success

stale[bot] commented 3 years ago

Hi :smile:, this issue has been automatically marked as stale because it has not had recent activity. Don't worry you can continue to work on this and ask @publiclab/reviewers to add "work in progress" label :tada: . Otherwise, it will be closed if no further activity occurs in 5 days -- but you can always re-open it if you like! :100: Thank you for your contributions :raised_hands: :balloon:.

Shreets commented 3 years ago

Hello, I am Outreachy Applicant and I would like to claim this issue. Thanks

Shreets commented 3 years ago

Hi @cesswairimu, I figured that this issue should be solved with addition of data-method="delete" to the following tag

https://github.com/publiclab/plots2/blob/8d2efcb96e9643a74957d5cdde208f21d01360fb/app/views/tag/show/_user_controls.html.erb#L11

However, what is stopping this from working is use of e.stopPropagation() as follows in the code:

https://github.com/publiclab/plots2/blob/8d2efcb96e9643a74957d5cdde208f21d01360fb/app/views/tag/show/_user_controls.html.erb#L51-L53

Apparently, jquery-ujs stops event propagation in its data-method attribute due to this e.stopPropagation()

This code had been added as part of this PR: https://github.com/publiclab/plots2/pull/5995

What this code does is, It stops the dropdown menu from closing when space outside the listed links(within dropdown menu) are clicked on

publiclab_original

This is how the drop down menu behaves when the stopPropagation is removed i.e the drop down menu closes when space outside the listed links are clicked.

publiclab_test

One way to go about this could be to remove stopPropagation like above and apply padding to the hyperlinks so that it responds to click when the div surrounding it is clicked. This will solve the problem to some extent. The dropdown wont close as long as we click within the hyperlinks.

hyperlinks

Could you please suggest how I should go about this?

Thanks!