danielgtaylor / malt.io

Malt.io free community for brewers
26 stars 11 forks source link

Signing in from new recipe page loses recipe being edited #2

Closed jensyt closed 12 years ago

jensyt commented 12 years ago

If you entered any changes to a new recipe while being logged out, the prompt to sign in will take you to your profile page instead of back to the recipe, causing the recipe to be lost. Using the browser's back button isn't a workaround, either, because all the recipe editing is performed using javascript.

Either you shouldn't let unregistered users create new recipes (bad idea, in my opinion), or you should save the recipe being edited and re-populate the new recipe page after sign-in instead of going to the profile.

danielgtaylor commented 12 years ago

I plan on fixing this by storing the current recipe from the /new page in the browser's window.localStorage. It should only be stored when editing a new recipe, should only be loaded when entering the /new URL and should persist as long as the user hasn't saved. When saved, the values should be cleared so a new recipe can be created again, and we should add a button which manually clears this data if the user wishes to start over.

jensyt commented 12 years ago

I was actually going to recommend local storage as a possible solution. That looks like a good approach.