rubyforgood / playtime

Supporting children and families experiencing homelessness in Washington, DC. Live app - https://wishlist.playtimeproject.org Organization Website:
http://www.playtimeproject.org/
MIT License
89 stars 52 forks source link

Open new tab when logged in #195

Closed seanmarcia closed 6 years ago

seanmarcia commented 6 years ago

Currently when a person is logged in, and they click 'Pledge to Donate' it does not take them to a new tab like it does when you are not logged in.

The stakeholder would like the 'Pledge to Donate' button to open in a new tab regardless if the user is logged in or not.

memcmahon commented 6 years ago

Hi @seanmarcia I would love to tackle this and a few other beginner friendly issues on this project - let me know if someone else is working on this, otherwise, look out for a PR in the next few days!

seanmarcia commented 6 years ago

Hey @memcmahon the issue(s) are yours! I sent you an invite to collab so you can send PR's directly and not have to fork :)

memcmahon commented 6 years ago

Awesome, thanks @seanmarcia!

memcmahon commented 6 years ago

Hey @seanmarcia - I just submitted a PR(#200) that I believe resolves this issue. After digging in to it, I think the main issue was slightly different than originally outlined. I have summarized my findings below and on the PR. Also, I noticed that the Travis CI build is failing on my push, but passing on the PR. I don't think I made any changes that would have caused a major failure, but any insight that you have on this would be appreciated!

Updated Description of Issue

Expected Behavior:

As a user (logged in or not) When I visit the root page And click on 'Pledge To Donate' A new tab is opened with the item's amazon url And the current page is redirected to the pledges page Then when I click on 'home' And click on 'Pledge to Donate' A new tab is opened with the item's amazon url And the current page is redirected to the pledges page

Actual Behavior:

As a user (logged in or not) When I visit the root page And click on 'Pledge To Donate' A new tab is opened with the item's amazon url And the current page is redirected to the pledges page Then when I click on 'home' And click on 'Pledge to Donate' Then the current page is redirected to the pledges page

-- OR --

As a user (logged in or not) When I visit the root page And click on 'Pledge To Donate' A new tab is opened with the item's amazon url And the current page is redirected to the pledges page Then when I click on my browser's back button A new tab is opened with the item's amazon url And the current page is redirected to the pledges page

As outlined above, the issue is that the expected behavior (a new tab being opened) is only happening the first time the home page is loaded and subsequently, only if the browser's back button is used. The fix should allow for the expected behavior regardless of the user's method of returning to the home page.