add tab title for book_topic_view; rearrange section methods

This commit is contained in:
Helmut Merz 2017-12-08 12:17:02 +01:00
parent 4b49fda269
commit 8c09a0e73d
3 changed files with 43 additions and 39 deletions

View file

@ -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
# 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
from loops.browser.resource import ResourceView as BaseResourceView
from loops.common import adapted, baseObject
from loops.util import _
standard_template = standard.standard_template
@ -54,42 +55,6 @@ class Base(object):
def sectionType(self):
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
def tabview(self):
if self.editable:
@ -181,10 +146,46 @@ class SectionView(Base, ConceptView):
def macro(self):
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):
breadcrumbsParent = ConceptView.breadcrumbsParent
tabTitle = _(u'title_bookTopicView')
@Lazy
def macro(self):

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: 0.13.1\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"
"Language-Team: loops developers <helmutm@cy55.de>\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?')"
msgstr "confirm('Wollen Sie die ausgewählten Objekte wirklich löschen?')"
msgid "title_bookTopicView"
msgstr "Übersicht"
# management interface
msgid "label_type"