Commit 41b12a0d authored by Romain Courteaud's avatar Romain Courteaud Committed by Kazuhiko Shiozaki

erp5_core/erp5_web_renderjs_ui_test: warn when no related document is found in case of jump

parent d1b36745
......@@ -14,7 +14,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiJump/macros/init" />
</tal:block>
<tal:block tal:define="notification_configuration python: {'class': 'success',
<tal:block tal:define="notification_configuration python: {'class': 'error',
'text': 'No Bar related.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
......
......@@ -4,6 +4,7 @@ Base_translateString = portal.Base_translateString
checkPerm = portal.portal_membership.checkPermission
redirect_context = context
status_level = 'success'
if jump_from_relative_url is None:
relation = context
......@@ -58,6 +59,7 @@ if len(related_list) == 0:
'No %s Related' % document_caption,
default=Base_translateString('No ${portal_type} related.',
mapping={'portal_type': Base_translateString(document_caption)}))
status_level = 'warning'
elif len(related_list) == 1:
relation_found = 1
......@@ -83,6 +85,7 @@ elif len(related_list) == 1:
"that_title": context.getTitleOrId() }),)
else :
message = Base_translateString("You are not authorised to view the related document.")
status_level = 'warning'
relation_found = 0
else:
......@@ -119,6 +122,7 @@ else:
related_object_list.append(obj)
if len(related_object_list) == 0 :
message = Base_translateString("You are not authorised to view any related document.")
status_level = 'warning'
relation_found = 0
else :
selection_uid_list = [x.getUid() for x in related_object_list]
......@@ -134,7 +138,7 @@ else:
uid=selection_uid_list,
portal_status_message=message))
query_params = dict(portal_status_message=message)
query_params = dict(portal_status_message=message, portal_status_level=status_level)
if selection_name and not relation_found:
query_params['selection_name'] = selection_name
query_params['selection_index'] = selection_index
......
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