Skip to content

[renderjs_ui] Implement FormBox field

Tomáš Peterka requested to merge feature/renderjs-formbox into master

FormBox receives form definition directly inside its field thanks to modification of hateoas script to include result of renderForm.

Implementation details

  • New embedded page template was added (gadget_erp5_pt_embedded_form_render) which only passes all arguments directly to the form. Form was not modified thus as many code as possible is reused.
  • Page:form was modified to accept erp5_document in its arguments. It is because FormBox uses it as direct subgadget.
  • FormBox.py was modified to fix a bug in case of embedded context - the Form was saving field into a wrong object. Thus validation phase of a FormBox yields FormEditor (as before) but if there is embedded context in the formbox field itself it will pass it to the Editor.

Refactoring

  • getHateoas renderField was heavily modified to be
    • sematically more consistent
    • not to use global variables which are defined after function definition (thus are not even clojures)
    • shorten and simplify field dictionary construction by exporting common parts
  • Base_edit was refactored meanwhile implementing FormBox edit (was deleted later because it was not needed)
    • the same problems as before - semantics and unreadibility by not using comprehensions and destructive assignment

Tests

  • FormBox with the same document as parent's and with fields directly on the document
  • FormBox with the same document as parent's but with fields which are not on the document (such as Phone on Person for example)
  • FormBox with different document than parent's

Changes carried out meanwhile

  • fix naming of formpage -> page_form gadget to be consistent with other pages
  • renderered -> rendered (variable name in page_form)
  • keep name jio_key consistent in every page_template (form page template gadgets)
  • clean up state dictionaries passed around (define important state variables in advance)

Merge request reports