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 | ||||
|     def textResources(self): | ||||
|         self.images = [[]] | ||||
|         self.otherResources = [] | ||||
|         result = [] | ||||
|         idx = 0 | ||||
|         for rv in self.getResources(): | ||||
|  | @ -115,7 +116,7 @@ class Base(object): | |||
|                         idx += 1 | ||||
|                         result.append(rv) | ||||
|                         self.images.append([]) | ||||
|             else: | ||||
|             elif rv.context.contentType.startswith('image/'): | ||||
|                 self.registerDojoLightbox() | ||||
|                 url = self.nodeView.getUrlForTarget(rv.context) | ||||
|                 src = '%s/mediaasset.html?v=small' % url | ||||
|  | @ -123,6 +124,8 @@ class Base(object): | |||
|                 img = dict(src=src, fullImageUrl=fullSrc, title=rv.title, | ||||
|                            description=rv.description, url=url, object=rv) | ||||
|                 self.images[idx].append(img) | ||||
|             else: | ||||
|                 self.otherResources.append(rv) | ||||
|         return result | ||||
| 
 | ||||
|     def getDocumentTypeForResource(self, r): | ||||
|  |  | |||
|  | @ -130,7 +130,8 @@ | |||
| 
 | ||||
| <metal:topic define-macro="topic" | ||||
|              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" /> | ||||
|   <h2 i18n:translate="" | ||||
|       tal:condition="children">Children</h2> | ||||
|  | @ -151,8 +152,18 @@ | |||
|           <a i18n:translate="" | ||||
|               tal:attributes="href python:view.getUrlForTarget(related.context)"> | ||||
|             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> | ||||
|   <metal:info use-macro="view/concept_macros/conceptresources" /> | ||||
| </metal:topic> | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue