[PATCH 3 of 7 saem_ref V3] [eac] Simplify timeline generation

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Mar 21 14:19:39 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490089406 -3600
#      Tue Mar 21 10:43:26 2017 +0100
# Node ID 4724f37332a92482c71937f01af4fdb3e5037135
# Parent  9c56fe5297e7a9afe7dcf917fb325ccd6f5356a0
[eac] Simplify timeline generation

now that relations are also displayed as 'standard' list which offers edition
links, we don't have to add them anymore into the timeline.

Related to #14591642

diff --git a/cubicweb_saem_ref/views/authorityrecord.py b/cubicweb_saem_ref/views/authorityrecord.py
--- a/cubicweb_saem_ref/views/authorityrecord.py
+++ b/cubicweb_saem_ref/views/authorityrecord.py
@@ -733,25 +733,15 @@ class AuthorityRecordTimelineJsonView(En
                                 text=entity.dc_description()),
         ]
         for successor_relation in entity.reverse_chronological_successor:
             predecessor = successor_relation.chronological_predecessor[0]
             data['date'].append(self.entity_as_date(
-                predecessor,
-                text=successor_relation.view(
-                    'saem.timeline-item',
-                    __redirectpath=entity.rest_path()),
-                tag=self._cw._('chronological_predecessor'))
-            )
+                predecessor, tag=self._cw._('chronological_predecessor')))
         for predecessor_relation in entity.reverse_chronological_predecessor:
             successor = predecessor_relation.chronological_successor[0]
             data['date'].append(self.entity_as_date(
-                successor,
-                text=predecessor_relation.view(
-                    'saem.timeline-item',
-                    __redirectpath=entity.rest_path()),
-                tag=self._cw._('chronological_successor'))
-            )
+                successor, tag=self._cw._('chronological_successor')))
         self.w(json_dumps({'timeline': data}))
 
     @staticmethod
     def entity_as_date(entity, **kwargs):
         """Return a dict suitable for insertion within the `date` entry of
@@ -770,24 +760,10 @@ class AuthorityRecordTimelineJsonView(En
                 date['endDate'] = ustrftime(calendarable.stop, '%Y,%m,%d')
         date.update(kwargs)
         return date
 
 
-class ChronologicalRelationTimelineItemView(EntityView):
-    """View for 'text' part of date event in timeline view"""
-    __regid__ = 'saem.timeline-item'
-    __select__ = is_instance('ChronologicalRelation')
-
-    def entity_call(self, entity, **urlparams):
-        self.w(entity.printable_value('description'))
-        vreg = self._cw.vreg
-        eschema = vreg.schema.eschema(entity.cw_etype)
-        if eschema.has_perm(self._cw, 'update'):
-            self.w(tags.a(title=self._cw._('edit'), klass='icon-pencil',
-                          href=entity.absolute_url('edition', **urlparams)))
-
-
 def _node(entity, rel=None):
     req = entity._cw
     if rel is not None:
         url = entity.absolute_url()
         descr = rel.printable_value('description', format='text/plain')


More information about the saem-devel mailing list