add tab title for book_topic_view; rearrange section methods
This commit is contained in:
		
							parent
							
								
									4b49fda269
								
							
						
					
					
						commit
						8c09a0e73d
					
				
					 3 changed files with 43 additions and 39 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| #  Copyright (c) 2013 Helmut Merz helmutm@cy55.de | #  Copyright (c) 2017 Helmut Merz helmutm@cy55.de | ||||||
| # | # | ||||||
| #  This program is free software; you can redistribute it and/or modify | #  This program is free software; you can redistribute it and/or modify | ||||||
| #  it under the terms of the GNU General Public License as published by | #  it under the terms of the GNU General Public License as published by | ||||||
|  | @ -34,6 +34,7 @@ from loops.browser.concept import ConceptRelationView as \ | ||||||
|     BaseConceptRelationView |     BaseConceptRelationView | ||||||
| from loops.browser.resource import ResourceView as BaseResourceView | from loops.browser.resource import ResourceView as BaseResourceView | ||||||
| from loops.common import adapted, baseObject | from loops.common import adapted, baseObject | ||||||
|  | from loops.util import _ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| standard_template = standard.standard_template | standard_template = standard.standard_template | ||||||
|  | @ -54,42 +55,6 @@ class Base(object): | ||||||
|     def sectionType(self): |     def sectionType(self): | ||||||
|         return self.conceptManager['section'] |         return self.conceptManager['section'] | ||||||
| 
 | 
 | ||||||
|     @Lazy |  | ||||||
|     def isPartOfPredicate(self): |  | ||||||
|         return self.conceptManager['ispartof'] |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def showNavigation(self): |  | ||||||
|         return self.typeOptions.show_navigation |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def breadcrumbsParent(self): |  | ||||||
|         for p in self.context.getParents([self.isPartOfPredicate]): |  | ||||||
|             return self.nodeView.getViewForTarget(p) |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def neighbours(self): |  | ||||||
|         pred = succ = None |  | ||||||
|         parent = self.breadcrumbsParent |  | ||||||
|         if parent is not None: |  | ||||||
|             myself = None |  | ||||||
|             children = list(parent.context.getChildren([self.isPartOfPredicate])) |  | ||||||
|             for idx, c in enumerate(children): |  | ||||||
|                 if c == self.context: |  | ||||||
|                     if idx > 0: |  | ||||||
|                         pred = self.nodeView.getViewForTarget(children[idx-1]) |  | ||||||
|                     if idx < len(children) - 1: |  | ||||||
|                         succ = self.nodeView.getViewForTarget(children[idx+1]) |  | ||||||
|         return pred, succ |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def predecessor(self): |  | ||||||
|         return self.neighbours[0] |  | ||||||
| 
 |  | ||||||
|     @Lazy |  | ||||||
|     def successor(self): |  | ||||||
|         return self.neighbours[1] |  | ||||||
| 
 |  | ||||||
|     @Lazy |     @Lazy | ||||||
|     def tabview(self): |     def tabview(self): | ||||||
|         if self.editable: |         if self.editable: | ||||||
|  | @ -181,10 +146,46 @@ class SectionView(Base, ConceptView): | ||||||
|     def macro(self): |     def macro(self): | ||||||
|         return book_template.macros['section'] |         return book_template.macros['section'] | ||||||
| 
 | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def isPartOfPredicate(self): | ||||||
|  |         return self.conceptManager['ispartof'] | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def breadcrumbsParent(self): | ||||||
|  |         for p in self.context.getParents([self.isPartOfPredicate]): | ||||||
|  |             return self.nodeView.getViewForTarget(p) | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def showNavigation(self): | ||||||
|  |         return self.typeOptions.show_navigation | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def neighbours(self): | ||||||
|  |         pred = succ = None | ||||||
|  |         parent = self.breadcrumbsParent | ||||||
|  |         if parent is not None: | ||||||
|  |             myself = None | ||||||
|  |             children = list(parent.context.getChildren([self.isPartOfPredicate])) | ||||||
|  |             for idx, c in enumerate(children): | ||||||
|  |                 if c == self.context: | ||||||
|  |                     if idx > 0: | ||||||
|  |                         pred = self.nodeView.getViewForTarget(children[idx-1]) | ||||||
|  |                     if idx < len(children) - 1: | ||||||
|  |                         succ = self.nodeView.getViewForTarget(children[idx+1]) | ||||||
|  |         return pred, succ | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def predecessor(self): | ||||||
|  |         return self.neighbours[0] | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def successor(self): | ||||||
|  |         return self.neighbours[1] | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class TopicView(Base, ConceptView): | class TopicView(Base, ConceptView): | ||||||
| 
 | 
 | ||||||
|     breadcrumbsParent = ConceptView.breadcrumbsParent |     tabTitle = _(u'title_bookTopicView') | ||||||
| 
 | 
 | ||||||
|     @Lazy |     @Lazy | ||||||
|     def macro(self): |     def macro(self): | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -3,7 +3,7 @@ msgstr "" | ||||||
| 
 | 
 | ||||||
| "Project-Id-Version: 0.13.1\n" | "Project-Id-Version: 0.13.1\n" | ||||||
| "POT-Creation-Date: 2007-05-22 12:00 CET\n" | "POT-Creation-Date: 2007-05-22 12:00 CET\n" | ||||||
| "PO-Revision-Date: 2015-10-25 12:00 CET\n" | "PO-Revision-Date: 2017-12-08 12:00 CET\n" | ||||||
| "Last-Translator: Helmut Merz <helmutm@cy55.de>\n" | "Last-Translator: Helmut Merz <helmutm@cy55.de>\n" | ||||||
| "Language-Team: loops developers <helmutm@cy55.de>\n" | "Language-Team: loops developers <helmutm@cy55.de>\n" | ||||||
| "MIME-Version: 1.0\n" | "MIME-Version: 1.0\n" | ||||||
|  | @ -1002,6 +1002,9 @@ msgstr "Objekte löschen" | ||||||
| msgid "confirm('Do you really want to delete the selected objects?')" | msgid "confirm('Do you really want to delete the selected objects?')" | ||||||
| msgstr "confirm('Wollen Sie die ausgewählten Objekte wirklich löschen?')" | msgstr "confirm('Wollen Sie die ausgewählten Objekte wirklich löschen?')" | ||||||
| 
 | 
 | ||||||
|  | msgid "title_bookTopicView" | ||||||
|  | msgstr "Übersicht" | ||||||
|  | 
 | ||||||
| # management interface | # management interface | ||||||
| 
 | 
 | ||||||
| msgid "label_type" | msgid "label_type" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue