Commit e3c97b8d authored by Romain Courteaud's avatar Romain Courteaud

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

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