alphagov/publisher — pull request #251 by vinayvinay (2014-09-03 14:41:02+00:00)
Title: Save and transition in one go

www.agileplannerapp.com/boards/173808/cards/5629

we save the edition form via an AJAX call before performing any transition on editions. this proved to be flaky on some occasions where editors could see a transition happen, but without edition changes.

this is an attempt to achieve the same behaviour in a more robust way. instead of relying on JS to submit edition and transition forms, we're using the default form submit.

we've achieved this by inlining the activity fields like (comments, fact check email addresses) with the edition form fields, so that they get submitted along-with the edition, in a single request.

also includes:
0. renames to convey the intent of the helpers and views better
0. extraction of button helpers into a separate helper file
0. showing the workflow button only on 'Edit' tab, to avoid confusing it with forms on other tabs like Editor's note
0. changing activity buttons from buttons to links. clicking buttons was causing the edition form to get saved, whereas the role of that button was to only open a modal window to accept parameters for transition like comments, and fact check email addresses.