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

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Mar 29 12:07:37 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490781749 -7200
#      Wed Mar 29 12:02:29 2017 +0200
# Node ID b00c8f906a2905c36df6757c05ca1ee421670a2c
# Parent  c2d18668ec69234bf5749a9b5c88b6b6f9bb404f
[ui] 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,10 +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 +52,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