[ui] Configure list item view for custodial history item.
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 12 Jul 2016 16:22:42 +0200
changeset 1419 010bc985bc6e
parent 1418 ca2fe27ff204
child 1420 c18e9eec211e
[ui] Configure list item view for custodial history item.
i18n/en.po
i18n/fr.po
views/content.py
--- a/i18n/en.po	Tue Jul 12 15:55:25 2016 +0200
+++ b/i18n/en.po	Tue Jul 12 16:22:42 2016 +0200
@@ -7,6 +7,12 @@
 "Generated-By: pygettext.py 1.5\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
+msgid " (mandatory timestamp)"
+msgstr ""
+
+msgid " (optional timestamp)"
+msgstr ""
+
 msgid " ALT_I18N "
 msgstr ""
 
--- a/i18n/fr.po	Tue Jul 12 15:55:25 2016 +0200
+++ b/i18n/fr.po	Tue Jul 12 16:22:42 2016 +0200
@@ -7,6 +7,12 @@
 "Generated-By: pygettext.py 1.5\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
+msgid " (mandatory timestamp)"
+msgstr " (horodatage obligatoire)"
+
+msgid " (optional timestamp)"
+msgstr " (horodatage optionel)"
+
 msgid " ALT_I18N "
 msgstr " OU "
 
--- a/views/content.py	Tue Jul 12 15:55:25 2016 +0200
+++ b/views/content.py	Tue Jul 12 16:22:42 2016 +0200
@@ -383,3 +383,16 @@
                                   ('seda_repository_object_pid', 'object'),
                                   ('seda_archive_unit_ref_id_from', 'object'),
                                   ('seda_repository_archive_unit_pid', 'object')])
+
+
+class CustodialHistoryItemLinkMetaEntityView(viewlib.LinkMetaEntityView):
+    __select__ = viewlib.LinkMetaEntityView.__select__ & is_instance('SEDACustodialHistoryItem')
+
+    def entity_call(self, entity):
+        super(CustodialHistoryItemLinkMetaEntityView, self).entity_call(entity)
+        if entity.reverse_seda_when:
+            when = entity.reverse_seda_when[0]
+            if when.user_cardinality == '1':
+                self.w(self._cw._(' (mandatory timestamp)'))
+            else:
+                self.w(self._cw._(' (optional timestamp)'))