Skip to content

feat: improve relation display

Arnaud Vergnet requested to merge topic/default/relations-label into branch/default

This MR improves how relations are displayed to the user in show and list modes.

In show modes, the relations labels are easier to understand:

  • Subject relations: show Relation_name object_name instead of Subject_name relation_name object_name
  • Object relations: show Subject_name relation_name this instead of Reverse subject_name relation_name object_name

To make the code more readable and coherent, fields to display relations are now encapsulated in one component name CubicWebRelationField, much like the already present CubicWebRelationInput. Users wanting to create their own admin panel without auto-generation can now use this component for any relation and it will adapt based on the cardinality.

And finally, to make ready easier, when no data is found for a relation (no matter the cardinality) or an attribute, the text N/A is shown.

Screenshot_2022-07-20_at_10-09-34_DEV_React-Admin_Cubicweb_Demo

Edited by Arnaud Vergnet

Merge request reports