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

externaluri toolbar component moved to cube datafeed

parent ce57a6af8e88
BLUE_ARROW = data('blue_arrow.png')
\ No newline at end of file
...@@ -24,29 +24,6 @@ uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'has_image', '*'), 'hi ...@@ -24,29 +24,6 @@ uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'has_image', '*'), 'hi
uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'title', '*'), 'hidden') uicfg.primaryview_section.tag_subject_of(('ClassifiedAd', 'title', '*'), 'hidden')
uicfg.actionbox_appearsin_addmenu.tag_subject_of(('ClassifiedAd', 'has_image', '*'), True) uicfg.actionbox_appearsin_addmenu.tag_subject_of(('ClassifiedAd', 'has_image', '*'), True)
# XXX this component looks generic... move it to cubicweb ?
class ExternalUriComponent(component.EntityVComponent):
"""component to display link to external uri"""
__regid__ = 'externaluricomp'
__select__ = (component.EntityVComponent.__select__ & has_related_entities('same_as') & ~is_instance('ExternalUri'))
context = 'ctxtoolbar'
def call(self, view=None):
self.cell_call(self.row or 0, self.col or 0)
def cell_call(self, row, col, view=None):
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="toolbarButton" id="%s">' % self.div_id())
imgurl = self._cw.uiprops['BLUE_ARROW']
if hasattr(entity, 'url'):
url = entity.url
else:
url = entity.same_as[0].uri
self.w(u'<a href="%s"><img src="%s"/></a>' % (url, xml_escape(imgurl)))
self.w(u'</div>')
### end of generic component
class ExternalUriGallery(baseviews.EntityView): class ExternalUriGallery(baseviews.EntityView):
__regid__ = 'gallery' __regid__ = 'gallery'
title = _('gallery') title = _('gallery')
......
Supports Markdown
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