Team254 / cheesy-parts

Part management database written for the 2013 season.
BSD 2-Clause "Simplified" License
22 stars 45 forks source link

Removed redirect back to referrer from parts delete #2

Closed ZachOrr closed 11 years ago

ZachOrr commented 11 years ago

Just a quick fix

When deleting a part, there's an issue with the redirects. It'll redirect you back to the part's page that's now deleted (I'm assuming params[:referrer] refers to the previous part's page). Now it only redirects back to the dashboard page.

patfair commented 11 years ago

The idea behind the params[:referrer] business though is that if you're using the delete button from the parts list in a sub-assembly page, you'll go back there after it's deleted instead of having to navigate your way back from the project page.

Maybe instead, we check the referrer and clear it out if it's equal to the part's own page, so that the original params[:referrer] || "/projects/#{project_id}" will fall through to the latter value.

ZachOrr commented 11 years ago

Sounds legit! I should have poked around a little more to see where other people could have come from to delete (I was just on the dashboard)

I'd fix the code and resubmit so you could just merge instead of updating it yourself, but I haven't dived into Ruby yet...

patfair commented 11 years ago

Done in 21216859fb53ac2c57edcacc04d7321d7892092e.