Changeset 3884 for waeup/branches


Ignore:
Timestamp:
26 Jan 2009, 15:15:29 (16 years ago)
Author:
uli
Message:

Display 'Add faculty' as link in sidebar. Some cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.py

    r3878 r3884  
    55from waeup.basecontainer import BaseContainer
    66from waeup.interfaces import IFacultyContainer
    7 from waeup.viewlets import MainArea, Index, Add
     7from waeup.viewlets import MainArea, LeftSidebar, Index, Add
    88from interfaces import IFaculty
    99from faculty import Faculty
     
    1414
    1515    grok.implements(IFacultyContainer)
     16    grok.require('waeup.manageUniversity')
    1617   
    1718    name = u'Faculties'
    18 
     19   
    1920    def getId(self, faculty):
    2021        """We need a unified id for each faculty, which acts as key.
     
    5455    grok.context(IFacultyContainer)
    5556    form_fields = grok.AutoFields(IFaculty)
     57    label = 'Add a faculty'
    5658
    5759    @grok.action('Add faculty')
     
    9597            pass
    9698        return result
     99
     100class AddFacultyLink(grok.Viewlet):
     101    """A link in the left sidebar displaying 'Add faculty'
     102    """
     103    grok.viewletmanager(LeftSidebar)
     104    grok.context(IFacultyContainer)
     105    grok.view(Index)
     106    grok.order(5)
     107    # This is so cool! This link is only displayed, when the user is
     108    # allowed to use it!
     109    grok.require('waeup.manageUniversity')
     110   
     111    def render(self):
     112        return u'<div class="portlet"><a href="add">Add faculty</a></div>'
Note: See TracChangeset for help on using the changeset viewer.