[PATCH saem_ref V2] [views] Customize title of SEDAArchiveTransferCloneAction

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Mar 14 10:57:07 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489136022 -3600
#      Fri Mar 10 09:53:42 2017 +0100
# Node ID 31683c3cc03392114aecde6f2c73681d7b7db9b5
# Parent  7f4f49b84a18866eab65c057d95ac98ae4322163
[views] Customize title of SEDAArchiveTransferCloneAction

accidentaly dropped by 57c663b9798a

diff --git a/cubicweb_saem_ref/i18n/en.po b/cubicweb_saem_ref/i18n/en.po
--- a/cubicweb_saem_ref/i18n/en.po
+++ b/cubicweb_saem_ref/i18n/en.po
@@ -682,10 +682,13 @@ msgstr ""
 
 msgctxt "OrganizationUnit"
 msgid "name"
 msgstr ""
 
+msgid "new version"
+msgstr ""
+
 msgid "new_version_of"
 msgstr "replaces"
 
 msgctxt "SEDAArchiveTransfer"
 msgid "new_version_of"
diff --git a/cubicweb_saem_ref/i18n/fr.po b/cubicweb_saem_ref/i18n/fr.po
--- a/cubicweb_saem_ref/i18n/fr.po
+++ b/cubicweb_saem_ref/i18n/fr.po
@@ -700,10 +700,13 @@ msgstr "nom"
 
 msgctxt "OrganizationUnit"
 msgid "name"
 msgstr "nom"
 
+msgid "new version"
+msgstr "nouvelle version"
+
 msgid "new_version_of"
 msgstr "remplace"
 
 msgctxt "SEDAArchiveTransfer"
 msgid "new_version_of"
diff --git a/cubicweb_saem_ref/views/clone.py b/cubicweb_saem_ref/views/clone.py
--- a/cubicweb_saem_ref/views/clone.py
+++ b/cubicweb_saem_ref/views/clone.py
@@ -35,12 +35,15 @@ simplified_pvs.tag_object_of(('*', 'new_
 
 # life-cycle management ############################################################################
 
 # Only show clone action for SEDA profiles if no clone has been created yet
 
-SEDAArchiveTransferCloneAction.__select__ &= (~has_related_entities('new_version_of', 'object')
-                                              & is_in_state('published'))
+class SAEMSEDAArchiveTransferCloneAction(SEDAArchiveTransferCloneAction):
+    __select__ = (SEDAArchiveTransferCloneAction.__select__
+                  & ~has_related_entities('new_version_of', 'object')
+                  & is_in_state('published'))
+    title = _('new version')
 
 
 def workflow_state(entity):
     """Return the state of the given entity."""
     return entity.cw_adapt_to('IWorkflowable').state
@@ -91,5 +94,10 @@ class SEDAArchiveTransferRelatedVersions
                 w(u'<li class="list-group-item">')
                 w(tags.span(self._cw._(workflow_state(entity)), klass='badge'))
                 entity.view('incontext', w=w)
                 w(u'</li>')
             w(u'</ul>')
+
+
+def registration_callback(vreg):
+    vreg.register_all(globals().values(), __name__, (SAEMSEDAArchiveTransferCloneAction,))
+    vreg.register_and_replace(SAEMSEDAArchiveTransferCloneAction, SEDAArchiveTransferCloneAction)


More information about the saem-devel mailing list