From 9ff3c9214e243e001bd70775b5fe02f689e83602 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 13 May 2012 16:21:05 +0200 Subject: [PATCH] breadcrumbs for sections and pages --- compound/book/browser.py | 23 +++++++++++++++++++++-- compound/book/configure.zcml | 8 ++++++++ compound/book/loops_book_de.dmp | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/compound/book/browser.py b/compound/book/browser.py index 584e478..f893be8 100644 --- a/compound/book/browser.py +++ b/compound/book/browser.py @@ -27,7 +27,9 @@ from zope.cachedescriptors.property import Lazy from cybertools.typology.interfaces import IType from loops.browser.lobo import standard -from loops.browser.concept import ConceptRelationView as BaseConceptRelationView +from loops.browser.concept import ConceptView +from loops.browser.concept import ConceptRelationView as \ + BaseConceptRelationView from loops.browser.resource import ResourceView as BaseResourceView from loops.common import adapted, baseObject @@ -36,7 +38,24 @@ standard_template = standard.standard_template book_template = ViewPageTemplateFile('view_macros.pt') -class PageLayout(standard.Layout): +class Base(object): + + @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) + + +class SectionView(Base, ConceptView): + + pass + + +class PageLayout(Base, standard.Layout): def getParts(self): parts = ['headline', 'keyquestions', 'quote', 'maintext', diff --git a/compound/book/configure.zcml b/compound/book/configure.zcml index f1837cd..98d0b40 100644 --- a/compound/book/configure.zcml +++ b/compound/book/configure.zcml @@ -17,6 +17,14 @@ + +