DemocracyOS/app — pull request #458 by bigokro (2014-10-22 03:57:23+00:00)
Title: On creating a law, routes to the page for the new law. Closes #421

This should fix the problem of not showing the Publish link. Also, it solves the other problems I mentioned before:
* Allows you to create clauses and links
* Saving changes now works without having to reload in the browser

There are some other things to consider, and if you don't like them, you are free to ask me to change them:

1. I added a call to scroll to the top after saving.
I think that will make it clearer to the user that their work was saved (before, I couldn't see the "saved successfully" message).

2. I'd never worked with Page.js before this project, which is why I'd asked if we should just redirect. The problem was solved by simply using the page() method.
HOWEVER, there was still a problem in that I couldn't get the "saved successfully" message to show up after a creation (because the page call generates a new LawForm, which the onsuccess handler can't reach). I solved the problem using the hack of a global variable, since I couldn't see a way to pass the information on the context without actually changing the URL. Is there a better way? What would you recommend?