Move data-objects tab of archive unit in simplified profiled next to the overriden tab
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Aug 2016 08:24:41 +0200
changeset 1560 01add3208c55
parent 1559 ac4598bdf2c5
child 1561 06cbe60f1524
Move data-objects tab of archive unit in simplified profiled next to the overriden tab And rename it consistently with other simplified profile specific tabs.
views/archiveunit.py
--- a/views/archiveunit.py	Fri Aug 26 07:55:29 2016 +0200
+++ b/views/archiveunit.py	Fri Aug 26 08:24:41 2016 +0200
@@ -281,6 +281,39 @@
         self.display_subobjects_list(seq)
 
 
+class SimplifiedArchiveUnitDataObjectReferencesTab(ArchiveUnitDataObjectReferencesTab):
+    """Tab for data object references of an archive unit within a simplified transfer: see
+    referenced data object as if they were children of the archive unit referencing them (only one
+    reference is allowed in such case, so this is fine).
+    """
+
+    __select__ = ArchiveUnitDataObjectReferencesTab.__select__ & simplified_profile()
+
+    def display_add_button(self, entity):
+        rtype_role_targets = archivetransfer.ArchiveTransferDataObjectsTab.rtype_role_targets
+        rtype_roles = [(rtype, role) for rtype, role, _ in rtype_role_targets]
+        params = self.url_params(entity)
+        params['referenced_by'] = unicode(entity.eid)
+        transfer = entity.container[0]
+        button = add_subobjects_button(transfer, rtype_roles, params)
+        if button:
+            # No button if user cannot add any relation.
+            self.w(button)
+            self.w(tags.div(klass='clearfix'))
+
+    def display_subobjects_list(self, entity):
+        for target in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
+            rset = self._cw.execute(
+                'Any DO, DOID, DOUC ORDERBY DOID WHERE DO is {0}, '
+                'DO id DOID, DO user_cardinality DOUC, '
+                'REF seda_data_object_reference_id DO, REF seda_data_object_reference SEQ, '
+                'SEQ eid %(x)s'.format(target), {'x': entity.eid})
+            if rset:
+                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__)
+
+
 # Top level ArchiveUnit form: create to distinct forms, one form archive unit reference and the
 # other for archive unit content. This is done by a mix of uicfg, form and renderer customization
 # depending on a 'unit_type' parameter in form params.
@@ -389,37 +422,3 @@
     __select__ = (widgets.NoTitleEntityInlinedFormRenderer.__select__
                   & is_instance('SEDADataObjectReference')
                   & simplified_profile())
-
-
-class ArchiveUnitDataObjectReferencesTab(ArchiveUnitDataObjectReferencesTab):
-    """Tab for data object references of an archive unit within a simplified transfer: see
-    referenced data object as if they were children of the archive unit referencing them (only one
-    reference is allowed in such case, so this is fine).
-    """
-
-    __regid__ = 'seda_au_data_objects_refs_tab'
-    __select__ = ArchiveUnitDataObjectReferencesTab.__select__ & simplified_profile()
-
-    def display_add_button(self, entity):
-        rtype_role_targets = archivetransfer.ArchiveTransferDataObjectsTab.rtype_role_targets
-        rtype_roles = [(rtype, role) for rtype, role, _ in rtype_role_targets]
-        params = self.url_params(entity)
-        params['referenced_by'] = unicode(entity.eid)
-        transfer = entity.container[0]
-        button = add_subobjects_button(transfer, rtype_roles, params)
-        if button:
-            # No button if user cannot add any relation.
-            self.w(button)
-            self.w(tags.div(klass='clearfix'))
-
-    def display_subobjects_list(self, entity):
-        for target in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
-            rset = self._cw.execute(
-                'Any DO, DOID, DOUC ORDERBY DOID WHERE DO is {0}, '
-                'DO id DOID, DO user_cardinality DOUC, '
-                'REF seda_data_object_reference_id DO, REF seda_data_object_reference SEQ, '
-                'SEQ eid %(x)s'.format(target), {'x': entity.eid})
-            if rset:
-                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__)