Ignore:
Timestamp:
12 Jan 2012, 11:43:29 (13 years ago)
Author:
Henrik Bettermann
Message:

Add breadcrumbs to student site layout. Omit the Students breadcrumb if principal is a student.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/browser.py

    r7451 r7453  
    3636    SIRPPage, SIRPEditFormPage, SIRPAddFormPage, SIRPDisplayFormPage,
    3737    ContactAdminForm, SIRPForm)
    38 from waeup.sirp.browser.interfaces import ICaptchaManager
     38from waeup.sirp.browser.interfaces import ICaptchaManager, IBreadcrumbIgnorable
    3939from waeup.sirp.browser.breadcrumbs import Breadcrumb
    4040from waeup.sirp.browser.resources import datepicker, datatable, tabs, warning
     
    6464from waeup.sirp.applicants.interfaces import IApplicantBaseData
    6565from waeup.sirp.hostels.hostel import NOT_OCCUPIED
     66from waeup.sirp.utils.helpers import get_current_principal
    6667
    6768def write_log_message(view, message):
     
    9697    grok.context(IStudentsContainer)
    9798    title = 'Students'
     99    #grok.implements(IBreadcrumbIgnorable)
     100
     101    @property
     102    def target(self):
     103        user = get_current_principal()
     104        #import pdb; pdb.set_trace()
     105        if getattr(user, 'user_type', None) == 'student':
     106            return None
     107        return self.viewname
    98108
    99109class StudentBreadcrumb(Breadcrumb):
     
    131141    grok.context(IStudentAccommodation)
    132142    title = 'Accommodation'
    133 
    134     #@property
    135     #def target(self):
    136     #    prm = get_principal_role_manager()
    137     #    principal = get_current_principal()
    138     #    roles = [x[0] for x in prm.getRolesForPrincipal(principal.id)]
    139     #    if 'waeup.Student' in roles:
    140     #        return 'index'
    141     #    else:
    142     #        return 'manage'
    143143
    144144class BedTicketBreadcrumb(Breadcrumb):
Note: See TracChangeset for help on using the changeset viewer.