Support for keyword isn't in the classification management rule but in content's indexation tab
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Aug 2016 11:44:05 +0200
changeset 1588 4c397b65bd77
parent 1587 3001f8a4afdd
child 1589 684686c36fe7
Support for keyword isn't in the classification management rule but in content's indexation tab So hide the former and add a tab for the later on archive unit in simplified profiles.
i18n/en.po
i18n/fr.po
views/archiveunit.py
--- a/i18n/en.po	Fri Aug 26 11:11:35 2016 +0200
+++ b/i18n/en.po	Fri Aug 26 11:44:05 2016 +0200
@@ -4975,6 +4975,9 @@
 msgid "seda_au_history_tab"
 msgstr ""
 
+msgid "seda_au_indexation_tab"
+msgstr ""
+
 msgid "seda_au_management_tab"
 msgstr ""
 
--- a/i18n/fr.po	Fri Aug 26 11:11:35 2016 +0200
+++ b/i18n/fr.po	Fri Aug 26 11:44:05 2016 +0200
@@ -4983,6 +4983,9 @@
 msgid "seda_au_history_tab"
 msgstr "historique de conservation"
 
+msgid "seda_au_indexation_tab"
+msgstr "indexation"
+
 msgid "seda_au_management_tab"
 msgstr "gestion"
 
--- a/views/archiveunit.py	Fri Aug 26 11:11:35 2016 +0200
+++ b/views/archiveunit.py	Fri Aug 26 11:44:05 2016 +0200
@@ -138,6 +138,7 @@
         'main_tab',
         _('seda_au_management_tab'),
         _('seda_au_content_tab'),
+        _('seda_au_indexation_tab'),
         _('seda_au_history_tab'),
         _('seda_au_archive_units_tab'),
         _('seda_au_data_objects_refs_tab'),
@@ -205,7 +206,6 @@
     rtype_role_targets = [
         ('seda_appraisal_rule', 'object', None),
         ('seda_access_rule', 'object', None),
-        ('seda_classification_rule', 'object', None),
     ]
     rsection, display_ctrl = rtags_from_rtype_role_targets(
         'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement', rtype_role_targets
@@ -283,6 +283,37 @@
     rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets)
 
 
+class SimplifiedArchiveUnitIndexationTab(tabs.TabsMixin, EntityView):
+    """Display content's indexation about an archive unit of a simplified profile.
+    """
+
+    __regid__ = 'seda_au_indexation_tab'
+    __select__ = ArchiveUnitContentTab.__select__ & simplified_profile()
+
+    def entity_call(self, entity):
+        seq = entity.first_level_choice.content_sequence
+        content = seq.related('seda_content', 'object').one()
+        content.view('seda_content_indexation_tab', w=self.w)
+
+
+class SimplifiedArchiveUnitContentIndexationView(content.ContentIndexationTab):
+
+    __select__ = content.ContentIndexationTab.__select__ & simplified_profile()
+
+    rtype_role_targets = [('seda_keyword', 'object', 'SEDAKeyword')]
+    tabid = 'seda_au_indexation_tab'
+
+    def url_params(self, entity):
+        params = super(SimplifiedArchiveUnitContentIndexationView, self).url_params(entity)
+        params['__redirectpath'] = self.parent(entity).rest_path()
+        return params
+
+    def parent(self, entity):
+        return (entity.seda_content[0]
+                .reverse_seda_seq_alt_archive_unit_archive_unit_ref_id_management[0]
+                .reverse_seda_alt_archive_unit_archive_unit_ref_id[0])
+
+
 class SimplifiedArchiveUnitHistoryTab(tabs.TabsMixin, EntityView):
     """Display content's custodial history about an archive unit of a simplified profile.
     """