Commit 8bbe2dd1 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[ui] Make msg argument of add_subobjects_button optional

parent bd53c1e36325
......@@ -62,7 +62,7 @@ def rtags_from_xsd_element(etype, element_name):
return rsection, display_ctrl
def add_subobjects_button(entity, msg, rtype_roles, extraurlparams):
def add_subobjects_button(entity, rtype_roles, extraurlparams, msg='add'):
"""Return an HTML dropdown button to add subobjects linked to `entity` through relations defined
in `rtype_roles` or an empty string if the user doesn't have the permission to add any of them.
......
......@@ -73,7 +73,7 @@ class ArchiveTransferDataObjectsTab(tabs.TabsMixin, EntityView):
def entity_call(self, entity):
urlparams = {'__redirectparams': 'tab=' + self.__regid__}
button = add_subobjects_button(entity, 'add', self.rtype_roles, urlparams)
button = add_subobjects_button(entity, self.rtype_roles, urlparams)
if button:
# No button if user cannot add any relation.
self.w(button)
......@@ -95,6 +95,7 @@ class ArchiveTransferArchiveUnitsTab(tabs.TabsMixin, EntityView):
rtype = 'seda_archive_unit'
role = 'object'
_('creating SEDAArchiveUnit (SEDAArchiveUnit seda_archive_unit '
'SEDAArchiveTransfer %(linkto)s)')
......@@ -102,9 +103,10 @@ class ArchiveTransferArchiveUnitsTab(tabs.TabsMixin, EntityView):
rset = entity.related(self.rtype, self.role)
if not rset:
urlparams = {'__redirectparams': 'tab=' + self.__regid__}
add_link = add_subobjects_button(entity, _('add'), [(self.rtype, self.role)], urlparams)
if add_link:
self.w(add_link)
button = add_subobjects_button(entity, [(self.rtype, self.role)], urlparams)
if button:
# No button if user cannot add any relation.
self.w(button)
self.w(tags.div(klass='clearfix'))
if rset:
subvid = 'seda.listitem'
......
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