Ignore:
Timestamp:
7 Jan 2010, 18:37:02 (15 years ago)
Author:
uli
Message:

Add viewletmanager and viewlet for generating breadcrumbs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/browser/viewlets.py

    r4680 r4700  
    88from waeup.browser.pages import (UniversityPage, FacultyContainerPage,
    99                                 DatacenterPage)
     10from waeup.browser.interfaces import IBreadcrumbContainer
    1011from waeup.interfaces import (IUniversity, IWAeUPObject, IWAeUPXMLExporter,
    1112                              IWAeUPXMLImporter, IFacultyContainer, IFaculty,
    1213                              IDepartment, ICourse, ICertificate,
    1314                              ICertificateCourse, IDataCenter)
    14 from waeup.utils.helpers import getInnerHTMLPart
    1515from waeup.viewlets import LeftSidebar, ActionBar
    1616
     
    1818grok.context(IWAeUPObject) # Make IWAeUPObject the default context
    1919
    20 #grok.context(zope.interface.Interface)
     20class BreadCrumbManager(grok.ViewletManager):
     21    grok.name('breadcrumbs')
     22
     23class BreadCrumbs(grok.Viewlet):
     24    grok.context(IWAeUPObject)
     25    grok.viewletmanager(BreadCrumbManager)
     26    grok.order(1)
     27
     28    def getEntries(self):
     29        result = []
     30        site = grok.getSite()
     31        context = self.context
     32        breadcrumbs = IBreadcrumbContainer(self.view)
     33        for breadcrumb in breadcrumbs:
     34            yield dict(
     35                title = breadcrumb.title,
     36                url = self.view.url(breadcrumb.context, breadcrumb.viewname)
     37                )
    2138
    2239#
Note: See TracChangeset for help on using the changeset viewer.