[new_profile] Use API for candidate creation and swal for success
This updates the candidate creation on the new profile page to use the LORIS API instead of duplicating the logic in PHP. The form already collects the exact data that a POST request to the API requires, but submits it to a different endpoint in a form encoding instead of a json encoding.
At the same time, the logic for the response is simplified by using a swal instead of a (very empty looking) new page. swals are already used for errors in the module, just not success. This change simplifies both the code and the UX.
Blocked by the release. Set it to "Draft" so that it doesn't accidentally get merged beforehand.
Nice!
Additionally, in modules/new_profile/php/new_profile.class.inc, private $_error; can be removed.
looks like that's also true of _pscid and _candID and all the namespaces (which phan was complaining about).. should be fixed in the last commit.
@xlecours now that the release is out I removed the blocked tag and rebased this, can you re-review it?
@xlecours I've fixed the indentation, added a catch to the code paths that don't have a catch for the resp.json(), fixed an error in the API that was causing it to return non-JSON and, if the gods are good, fixed the failing test by checking the swal title instead of an element in the body. (Still needs to run on GitHub to be sure that it's working..)
@driusan I haven't tested it because I am in the middle of other things.
@driusan Tested now. it's working all right.