Commit f61caef1 authored by Roque's avatar Roque

erp5_hal_json_style: minor change in form definition structure

parent 0c709c37
...@@ -1541,7 +1541,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1541,7 +1541,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
result_dict['_links']['me'] = { result_dict['_links']['me'] = {
"href": default_document_uri_template % { "href": default_document_uri_template % {
"root_url": site_root.absolute_url(), "root_url": site_root.absolute_url(),
"relative_url": person.getRelativeUrl(), "relative_url": person.getRelativeUrl(),
"script_id": script.id "script_id": script.id
}, },
# '_relative_url': person.getRelativeUrl() # '_relative_url': person.getRelativeUrl()
...@@ -2224,12 +2224,11 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -2224,12 +2224,11 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
result_dict['title'] = traversed_document.getTitle() result_dict['title'] = traversed_document.getTitle()
extra_param_json = {} extra_param_json = {}
# TODO: 'type' should be include outside "_links", but itrequires changes on js side rendering
if not is_portal: if not is_portal:
document_type_name = traversed_document.getPortalType() document_type_name = traversed_document.getPortalType()
document_type = getattr(portal.portal_types, document_type_name, None) document_type = getattr(portal.portal_types, document_type_name, None)
if document_type is not None: if document_type is not None:
result_dict['_links']['type'] = { result_dict['type'] = {
"href": default_document_uri_template % { "href": default_document_uri_template % {
"root_url": site_root.absolute_url(), "root_url": site_root.absolute_url(),
"relative_url": document_type.getRelativeUrl(), "relative_url": document_type.getRelativeUrl(),
...@@ -2238,11 +2237,9 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -2238,11 +2237,9 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
"name": Base_translateString(traversed_document.getPortalType()) "name": Base_translateString(traversed_document.getPortalType())
} }
# TODO: 'parent' should be include outside "_links", but it requires changes on js side rendering
if not is_portal:
container = traversed_document.getParentValue() container = traversed_document.getParentValue()
if container != portal: if container != portal:
result_dict['_links']['parent'] = { result_dict['parent'] = {
"href": default_document_uri_template % { "href": default_document_uri_template % {
"root_url": site_root.absolute_url(), "root_url": site_root.absolute_url(),
"relative_url": container.getRelativeUrl(), "relative_url": container.getRelativeUrl(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment