Refactor and bugfix detached form

* If custom form content is present, it is not replicated anymore across main
  and detached form, leading to duplicate parameter passing
* Remove ugly parameter parsing (still some left)
* Remove code duplication and hijacking of the form action. The detached form
  is dependent on the main one, and when it is submitted, the inputs are copied
  over the main one, and that one is submitted
* Remove dead code and unused variables
Lay out code like an human
Work around sprockets stupidity
Prevent infinite loops