Commit 1938c542 authored by Romain Courteaud's avatar Romain Courteaud

erp5_hal_json_style: do not propagate the previous form for jump action

This allows getting stable URL which can be used in ERP5JS to highlight the current jump
parent 1601cbd4
...@@ -1474,7 +1474,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1474,7 +1474,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# select correct URL template based on action_type and form page template # select correct URL template based on action_type and form page template
url_template_key = "traverse_generator" url_template_key = "traverse_generator"
if erp5_action_key not in ("view", "object_view", "object_jio_view"): if erp5_action_key not in ("view", "object_view", "object_jio_view", "object_jio_jump"):
url_template_key = "traverse_generator_action" url_template_key = "traverse_generator_action"
# but when we do not have the last form id we do not pass is of course # but when we do not have the last form id we do not pass is of course
if not (current_action.get('view_id', '') or last_form_id): if not (current_action.get('view_id', '') or last_form_id):
......
...@@ -604,7 +604,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin): ...@@ -604,7 +604,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog") self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'], self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0=" % ( "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query" % (
self.portal.absolute_url(), self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl()))) urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries") self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries")
...@@ -961,7 +961,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin): ...@@ -961,7 +961,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog") self.assertEqual(result_dict['_links']['action_workflow'][0]['name'], "custom_action_no_dialog")
self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'], self.assertEqual(result_dict['_links']['action_object_jio_jump']['href'],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0=" % ( "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query" % (
self.portal.absolute_url(), self.portal.absolute_url(),
urllib.quote_plus(document.getRelativeUrl()))) urllib.quote_plus(document.getRelativeUrl())))
self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries") self.assertEqual(result_dict['_links']['action_object_jio_jump']['title'], "Queries")
......
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