Commit c09bd2dd authored by Yann Voté's avatar Yann Voté
Browse files

[ui] Do not display trash button if there is only one content element left

parent 90195500cb8d
......@@ -216,6 +216,11 @@ class ArchiveUnitContentTab(viewlib.SubObjectsTab):
self.display_add_button(seq)
self.display_subobjects_list(seq)
def display_subobjects_list(self, entity):
rset = entity.related('seda_content', 'object')
self._cw.view('list', rset=rset, parent=self.parent(entity), w=self.w,
subvid=self.subvid, tabid=self.__regid__, delete=len(rset) > 1)
class ArchiveUnitArchiveUnitsTab(tabs.TabsMixin, EntityView):
"""Tab for sub-archive units of an archive unit"""
......
......@@ -182,14 +182,14 @@ class SubObjectsTab(tabs.TabsMixin, EntityView):
self.w(button)
self.w(tags.div(klass='clearfix'))
def display_subobjects_list(self, entity):
def display_subobjects_list(self, entity, edit=True, delete=True):
for rtype, role, target in self.rtype_role_targets:
rset = entity.related(rtype, role)
if rset:
if target is not None:
self.w('<h2>%s</h2>' % self._cw.__(target + '_plural'))
self._cw.view('list', rset=rset, parent=self.parent(entity), w=self.w,
subvid=self.subvid, tabid=self.__regid__)
subvid=self.subvid, tabid=self.__regid__, edit=edit, delete=delete)
def url_params(self, entity):
return {'__redirectparams': 'tab=' + self.__regid__}
......
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