Commit 60d6b024 authored by Nicolas Chauvat's avatar Nicolas Chauvat
Browse files

[views] thumbnails gallery for ads

parent 3d6e44cf83f6
......@@ -44,13 +44,22 @@ class ExternalUriComponent(component.EntityVComponent):
### end of generic component
class AdGallery(baseviews.EntityView):
__regid__ = 'gallery'
title = _('gallery')
__select__ = implements('ClassifiedAd')
def call(self):
for entity in self.cw_rset.entities():
for img in entity.has_image:
self.w(u'<img style="max-height: 100px; padding: 2px" src="%s" />' % img.uri)
class ClassifiedAdPrimaryView(primary.PrimaryView):
__select__ = primary.PrimaryView.__select__ & implements('ClassifiedAd')
def render_entity_relations(self, entity):
super(ClassifiedAdPrimaryView, self).render_entity_relations(entity)
if entity.has_image:
self.w(u'<div><img style="max-height: 100px" src="%s" /></div>' % entity.has_image[0].uri)
self.wview('gallery-of-ads', self.cw_rset, 'null')
class ClassifiedAdInContextView(baseviews.SameETypeListItemView):
__select__ = implements('ClassifiedAd')
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