Commit aec7a7d7 authored by Nicolas Chauvat's avatar Nicolas Chauvat
Browse files

make difference between container and item

parent fbaceb1c1f9f
......@@ -21,6 +21,13 @@ from cubicweb.view import EntityAdapter
class IActivityStreamAdapter(EntityAdapter):
__regid__ = 'IActivityStream'
@property
def rql(self):
raise NotImplementedError()
class IActivityStreamItemAdapter(EntityAdapter):
__regid__ = 'IActivityStreamItem'
@property
def content(self):
raise NotImplementedError()
......@@ -29,7 +36,7 @@ class IActivityStreamAdapter(EntityAdapter):
def date(self):
raise NotImplementedError()
class AnyAStreamAdapter(IActivityStreamAdapter):
class AnyAStreamItemAdapter(IActivityStreamItemAdapter):
__select__ = is_instance('Any')
@property
......@@ -40,7 +47,7 @@ class AnyAStreamAdapter(IActivityStreamAdapter):
def date(self):
return self.entity.creation_date
class TrinfoAStreamAdapter(AnyAStreamAdapter):
class TrinfoAStreamItemAdapter(AnyAStreamItemAdapter):
__select__ = is_instance('TrInfo')
@property
......
......@@ -5,11 +5,22 @@ class AStreamView(EntityView):
__regid__ = 'activitystream'
__select__ = EntityView.__select__ & adaptable('IActivityStream')
def cell_call(self, row, col):
entity = self.cw_rset.get_entity(row, col)
rset = self._cw.execute(entity.cw_adapt_to('IActivityStream').rql,
dict(x=entity.eid))
self.paginate(rset=rset)
self.wview('activitystream_item', rset, 'null')
class AStreamItemView(EntityView):
__regid__ = 'activitystream_item'
__select__ = EntityView.__select__ & adaptable('IActivityStreamItem')
def cell_call(self, row, col):
self._cw.add_css('cubes.astream.css')
entity = self.cw_rset.get_entity(row, col)
ablock = entity.dc_creator()
activity = entity.cw_adapt_to('IActivityStream')
activity = entity.cw_adapt_to('IActivityStreamItem')
self.w(u'<div class="activitystream">'
u'<span class="author">%s</span>'
u'<span class="msgtxt">%s</span>'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment