Commit 1828b7a3 authored by Nicolas Chauvat's avatar Nicolas Chauvat
Browse files

[views] remove link to other pictures and add explain similarity action

parent 326fcbfd0e39
......@@ -15,6 +15,7 @@ from cubicweb.web.views import primary, baseviews
from cubicweb.web.facet import RelationFacet, AttributeFacet, RangeFacet, DateRangeFacet
from cubes.similarity import get_vspace
from cubes.similarity.views import SimilarAction
uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'same_as', '*'), 'hidden')
uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'url', '*'), 'hidden')
......@@ -68,23 +69,12 @@ class ClassifiedAdInContextView(baseviews.SameETypeListItemView):
def cell_call(self, row, col, contexteid=None):
entity = self.cw_rset.get_entity(row, col)
abs_url = entity.absolute_url()
if entity.url:
link = entity.url
elif entity.same_as:
link = entity.same_as[0].uri
else:
link = None
self.w(u'<table><tr><td width="20%" align="right">')
if entity.has_image:
self.w(u'<a href="%s"><img height="100" src="%s" /></a>' % (abs_url, entity.has_image[0].uri))
self.w(u'</td><td>')
self.w(u'<div><a href="%s">%s</a><br/>%s</div>' %
(abs_url, xml_escape(entity.title or u''), xml_escape(entity.description or u'')))
if link:
self.w(u'<div><a href="%s">' % link)
self.w(u'voir autres photos')
if link:
self.w(u'</a></div>')
self.w(u'</td></tr></table>')
# class ClassifiedPriceFacet(RangeFacet):
......@@ -134,3 +124,6 @@ class ClosestAdsBox(box.EntityBoxTemplate):
self.w(u'</div>')
self.w(u'</div>')
self.w(u'</div>')
class ClassifiedAdSimilarAction(SimilarAction):
__select__ = is_instance('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