Ignore:
Timestamp:
9 Jan 2010, 18:33:54 (15 years ago)
Author:
uli
Message:

Move LeftSidebarLink? to viewlets.

Location:
waeup/branches/ulif-layout/src/waeup/browser
Files:
3 edited

Legend:

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

    r4757 r4774  
    11from waeup.browser.layout import (WAeUPPage, WAeUPLayout, WAeUPDisplayFormPage,
    22                                  WAeUPEditFormPage, WAeUPAddFormPage,
    3                                   LeftSidebarLink, NullValidator)
     3                                  NullValidator)
  • waeup/branches/ulif-layout/src/waeup/browser/layout.py

    r4756 r4774  
    55from megrok.layout import Page, Layout, EditForm, DisplayForm, AddForm
    66from waeup.interfaces import IWAeUPObject
    7 from waeup.viewlets import LeftSidebar
    87from z3c.flashmessage.interfaces import IMessageSource
    98from zope.component import queryUtility, ComponentLookupError
     
    8281    grok.baseclass()
    8382
    84 class LeftSidebarLink(grok.Viewlet):
    85     """ An entry on left sidebar.
    86 
    87     This is only a baseclass that won't be rendered actually. Deriving
    88     viewlets can override certain values and will be rendered with the
    89     values set here as default.
    90     """
    91     grok.baseclass()
    92     grok.viewletmanager(LeftSidebar)
    93     grok.context(Interface)
    94     grok.order(5)
    95     grok.require('waeup.manageUniversity')
    96 
    97     title = 'Text of link'
    98     @property
    99     def url(self):
    100         return 'URL to link to'
    101    
    102     def render(self):
    103         return u'<div class="portlet"><a href="%s">%s</a></div>' % (
    104             self.url, self.title)
    105 
    10683class SiteLayout(WAeUPLayout):
    10784    """ The general site layout.
  • waeup/branches/ulif-layout/src/waeup/browser/viewlets.py

    r4773 r4774  
    1515                              IDepartment, ICourse, ICertificate,
    1616                              ICertificateCourse, IDataCenter)
    17 from waeup.viewlets import LeftSidebar
    1817
    1918grok.templatedir('templates')
    2019grok.context(IWAeUPObject) # Make IWAeUPObject the default context
     20
     21class LeftSidebar(grok.ViewletManager):
     22    grok.name('left')
    2123
    2224class BreadCrumbManager(grok.ViewletManager):
     
    6264        # We cannot simply replace local sites.
    6365        self.can_import = not ISite.providedBy(self.context)
     66
     67class LeftSidebarLink(grok.Viewlet):
     68    """ An entry on left sidebar.
     69
     70    This is only a baseclass that won't be rendered actually. Deriving
     71    viewlets can override certain values and will be rendered with the
     72    values set here as default.
     73    """
     74    grok.baseclass()
     75    grok.viewletmanager(LeftSidebar)
     76    grok.context(IWAeUPObject)
     77    grok.order(5)
     78    grok.require('waeup.manageUniversity')
     79
     80    title = 'Text of link'
     81    @property
     82    def url(self):
     83        return 'URL to link to'
     84   
     85    def render(self):
     86        return u'<div class="portlet"><a href="%s">%s</a></div>' % (
     87            self.url, self.title)
     88
    6489
    6590           
Note: See TracChangeset for help on using the changeset viewer.