Ignore:
Timestamp:
6 Nov 2011, 17:18:51 (13 years ago)
Author:
Henrik Bettermann
Message:

Define target method for breadcrumbs. We can't use the viewname attribute.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/breadcrumbs.py

    r6918 r7008  
    5050        if self._parent is not 0:
    5151            return (self._parent, self.parent_viewname)
    52        
     52
    5353        if self.viewname != 'index':
    5454            self._parent = self.context
     
    6161            return (self._parent, self.parent_viewname)
    6262        return None
     63
     64    @property
     65    def target(self):
     66        return self.viewname
    6367
    6468class UniversityBreadcrumb(Breadcrumb):
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/interfaces.py

    r5957 r7008  
    99    ICourseContainer, ICourse, ICourseAdd, ICertificateContainer,
    1010    ICertificate, ICertificateAdd, ICertificateCourse, ICertificateCourseAdd)
     11
    1112class IBreadcrumb(Interface):
    1213    """Provide breadcrumbs.
    1314    """
    14     title = schema.TextLine(
    15         title = u'Context description',
    16         readonly = True,
    17         )
    18     viewname = schema.TextLine(
    19         title = u'The viewname, for which the breadcrumb is provided.',
    20         readonly = True,
    21         default = u'index'
    22         )
    23     parent_viewname = schema.TextLine(
    24         title = u'The viewname of the parent to use.',
    25         readonly = True,
    26         default = u'index'
    27         )
     15    title = Attribute("Context description")
     16    viewname = Attribute("The viewname, for which the breadcrumb is provided.")
     17    parent_viewname = Attribute("The viewname of the parent to use.")
    2818    parent = Attribute("The parent object.")
    2919    context = Attribute("The context of the breadcrumb.")
    30 
    31 
    32     def getURL(view=None):
    33         """Return a URL to the breadcrumb target.
    34         """
     20    target = Attribute("The link target.")
    3521
    3622class IBreadcrumbIgnorable(Interface):
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r6953 r7008  
    180180            yield dict(
    181181                title = breadcrumb.title,
    182                 url = self.view.url(breadcrumb.context, breadcrumb.viewname)
     182                url = self.view.url(breadcrumb.context, breadcrumb.target)
    183183                )
    184184
Note: See TracChangeset for help on using the changeset viewer.