[download box] refactor to ease when one want to propose multiple elements to download stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Tue, 09 Nov 2010 17:12:21 +0100
branchstable
changeset 6699 e20f350fc0af
parent 6698 b353e868b74f
child 6700 accb7290a31c
[download box] refactor to ease when one want to propose multiple elements to download
web/views/idownloadable.py
--- a/web/views/idownloadable.py	Tue Nov 09 15:48:11 2010 +0100
+++ b/web/views/idownloadable.py	Tue Nov 09 17:12:21 2010 +0100
@@ -57,11 +57,15 @@
     order = 10
     title = _('download')
 
+    def init_rendering(self):
+        self.items = [self.entity]
+
     def render_body(self, w):
-        w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
-          % (xml_escape(self.entity.cw_adapt_to('IDownloadable').download_url()),
-             self._cw.uiprops['DOWNLOAD_ICON'],
-             self._cw._('download icon'), xml_escape(self.entity.dc_title())))
+        for item in self.items:
+            w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
+              % (xml_escape(item.cw_adapt_to('IDownloadable').download_url()),
+                 self._cw.uiprops['DOWNLOAD_ICON'],
+                 self._cw._('download icon'), xml_escape(item.dc_title())))
 
 
 class DownloadView(EntityView):