diff --git a/browser/concept.py b/browser/concept.py index e795ade..0aa03e3 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -413,7 +413,7 @@ class ConceptView(BaseView): if r.order != pos: r.order = pos - def resources(self): + def getResources(self): form = self.request.form #if form.get('loops.viewName') == 'index.html' and self.editable: if self.editable: @@ -430,6 +430,9 @@ class ConceptView(BaseView): if fv.check(r.first): yield ResourceRelationView(r, self.request, contextIsSecond=True) + def resources(self): + return self.getResources() + @Lazy def resourcesList(self): from loops.browser.resource import ResourceRelationView diff --git a/compound/book/browser.py b/compound/book/browser.py index d6e2232..533e12d 100644 --- a/compound/book/browser.py +++ b/compound/book/browser.py @@ -77,6 +77,30 @@ class SectionView(Base, ConceptView): def sectionType(self): return self.conceptManager['section'] + def getResources(self): + relViews = super(SectionView, self).getResources() + return relViews + + @Lazy + def textResources(self): + self.images = [[]] + result = [] + idx = 0 + for rv in self.getResources(): + if rv.context.contentType.startswith('text/'): + idx += 1 + result.append(rv) + self.images.append([]) + else: + self.registerDojoLightbox() + url = self.nodeView.getUrlForTarget(rv.context) + src = '%s/mediaasset.html?v=small' % url + fullSrc = '%s/mediaasset.html?v=medium' % url + img = dict(src=src, fullImageUrl=fullSrc, title=rv.title, + description=rv.description, url=url, object=rv) + self.images[idx].append(img) + return result + def getCssClassForResource(self, r): for c in r.context.getConcepts([self.defaultPredicate]): if c.conceptType == self.documentTypeType: diff --git a/compound/book/view_macros.pt b/compound/book/view_macros.pt index d64994d..cef53c2 100644 --- a/compound/book/view_macros.pt +++ b/compound/book/view_macros.pt @@ -14,7 +14,7 @@ -
+
@@ -45,6 +46,15 @@
+