show resources (other than text) in book_topic_view
This commit is contained in:
parent
05b13e154f
commit
67fe55056f
2 changed files with 16 additions and 2 deletions
|
@ -107,6 +107,7 @@ class Base(object):
|
||||||
@Lazy
|
@Lazy
|
||||||
def textResources(self):
|
def textResources(self):
|
||||||
self.images = [[]]
|
self.images = [[]]
|
||||||
|
self.otherResources = []
|
||||||
result = []
|
result = []
|
||||||
idx = 0
|
idx = 0
|
||||||
for rv in self.getResources():
|
for rv in self.getResources():
|
||||||
|
@ -115,7 +116,7 @@ class Base(object):
|
||||||
idx += 1
|
idx += 1
|
||||||
result.append(rv)
|
result.append(rv)
|
||||||
self.images.append([])
|
self.images.append([])
|
||||||
else:
|
elif rv.context.contentType.startswith('image/'):
|
||||||
self.registerDojoLightbox()
|
self.registerDojoLightbox()
|
||||||
url = self.nodeView.getUrlForTarget(rv.context)
|
url = self.nodeView.getUrlForTarget(rv.context)
|
||||||
src = '%s/mediaasset.html?v=small' % url
|
src = '%s/mediaasset.html?v=small' % url
|
||||||
|
@ -123,6 +124,8 @@ class Base(object):
|
||||||
img = dict(src=src, fullImageUrl=fullSrc, title=rv.title,
|
img = dict(src=src, fullImageUrl=fullSrc, title=rv.title,
|
||||||
description=rv.description, url=url, object=rv)
|
description=rv.description, url=url, object=rv)
|
||||||
self.images[idx].append(img)
|
self.images[idx].append(img)
|
||||||
|
else:
|
||||||
|
self.otherResources.append(rv)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getDocumentTypeForResource(self, r):
|
def getDocumentTypeForResource(self, r):
|
||||||
|
|
|
@ -130,7 +130,8 @@
|
||||||
|
|
||||||
<metal:topic define-macro="topic"
|
<metal:topic define-macro="topic"
|
||||||
tal:define="children children|python:list(item.children());
|
tal:define="children children|python:list(item.children());
|
||||||
textResources textResources|item/textResources">
|
textResources textResources|item/textResources;
|
||||||
|
resources item/otherResources">
|
||||||
<metal:info use-macro="view/concept_macros/concepttitle" />
|
<metal:info use-macro="view/concept_macros/concepttitle" />
|
||||||
<h2 i18n:translate=""
|
<h2 i18n:translate=""
|
||||||
tal:condition="children">Children</h2>
|
tal:condition="children">Children</h2>
|
||||||
|
@ -151,8 +152,18 @@
|
||||||
<a i18n:translate=""
|
<a i18n:translate=""
|
||||||
tal:attributes="href python:view.getUrlForTarget(related.context)">
|
tal:attributes="href python:view.getUrlForTarget(related.context)">
|
||||||
more...</a></p>
|
more...</a></p>
|
||||||
|
<div tal:repeat="image python:
|
||||||
|
item.images[repeat['related'].index() + 1]">
|
||||||
|
<a dojoType="dojox.image.Lightbox" group="mediasset"
|
||||||
|
i18n:attributes="title"
|
||||||
|
tal:attributes="href image/fullImageUrl;
|
||||||
|
title image/title">
|
||||||
|
<img tal:attributes="src image/src;
|
||||||
|
alt image/title" /></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<metal:info use-macro="view/concept_macros/conceptresources" />
|
||||||
</metal:topic>
|
</metal:topic>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue