gramps-web
gramps-web copied to clipboard
#444 use profile.name_display on some pages
... instead of the join of profile.name_given and profile.name_surname/
This is just a sketch code, however working good for me. It is a sort of "natural" solution to use the user defined format to display primary names instead of just concatenation of profile.name_given and profile.name_surname via a spacebar, as it is implemented in many places in the main branch now.
However such a solution is incomplete: for example, the names in the associations list are rendered from the serialized Person class instances
https://github.com/gramps-project/gramps-web/blob/31ed0bd98b8eec1b903f2215f91bcfaabcd7a97b/src/util.js#L45-L#53
and the Person class contains no name_display field which contained the primary name in the user defined format.
The serialized Person class instances are produced by the following backend code:
https://github.com/gramps-project/gramps-web-api/blob/fdb0d4b4157494994acc67572c8fc6312a12f06c/gramps_webapi/api/resources/util.py#L771-L774
...
https://github.com/gramps-project/gramps-web-api/blob/fdb0d4b4157494994acc67572c8fc6312a12f06c/gramps_webapi/api/resources/util.py#L809-L819
and the same code is used from src/components/GrampsjsSearchResultList.js
https://github.com/gramps-project/gramps-web/blob/31ed0bd98b8eec1b903f2215f91bcfaabcd7a97b/src/components/GrampsjsSearchResultList.js#L96-L101
via
https://github.com/gramps-project/gramps-web/blob/31ed0bd98b8eec1b903f2215f91bcfaabcd7a97b/src/util.js#L311-L314.
Couldn't we add, for example the person profile to the serialized Person class instances when they are returned in the REST API reply? The serialized Person class instances on the client side can contain additional fields to the server side instances, can't they?