[PATCH 7 of 8 sherpa] Fix order of actions visible in entity type list

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Mar 29 12:00:02 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490696759 -7200
#      Tue Mar 28 12:25:59 2017 +0200
# Node ID d1710484c8d1ea764b38a15dbf5605a663a6c7f7
# Parent  2e4cdb055c93a251cccd93322655fe668ad5cd17
Fix order of actions visible in entity type list

Should first propose to add a new entity, then to import one when it's relevant,
then only to delete it.

Closes #17066617

diff --git a/cubicweb_sherpa/views/components.py b/cubicweb_sherpa/views/components.py
--- a/cubicweb_sherpa/views/components.py
+++ b/cubicweb_sherpa/views/components.py
@@ -29,11 +29,11 @@ class AddEntityAction(action.Action):
     __select__ = (multi_lines_rset()
                   & has_permission('add')
                   & is_instance('AuthorityRecord', 'ConceptScheme',
                                 'SEDAArchiveTransfer', 'SEDAArchiveUnit'))
     extra_kwargs = {'SEDAArchiveUnit': {'unit_type': 'unit_content'}}
-
+    order = 1
     @property
     def title(self):
         etype = self.cw_rset.description[0][0]
         return self._cw.__('New %s' % etype).lower()
 
@@ -51,10 +51,11 @@ class ImportEntityAction(action.Action):
     selector.
     """
     __abstract__ = True
     __regid__ = 'sherpa.import_entity'
     __select__ = multi_lines_rset() & has_permission('add')
+    order = 2
 
     @property
     def title(self):
         etype = self.cw_rset.description[0][0]
         return self._cw.__('import %s' % etype)


More information about the saem-devel mailing list