Ignore:
Timestamp:
31 Jul 2009, 23:47:43 (15 years ago)
Author:
uli
Message:

Add a content viewlet for courses that displays faculty and
department. Helps users to orientate.

File:
1 edited

Legend:

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

    r4449 r4510  
    66from waeup.interfaces import ICourse
    77from waeup.viewlets import MainArea, Index, Manage, FormWrapMixin
     8from waeup.utils.helpers import getName
    89
    910class Course(grok.Model):
     
    5152    grok.view(Index)
    5253    grok.require('waeup.manageUniversity')
     54    grok.order(3)
    5355
    5456    formview_name = 'displayform' # The name of the formview we want
    5557                                  # to be rendered in this viewlet.
    5658
     59class ContentHeader(grok.Viewlet):
     60    """A viewlet that renders the faculty, department and course title.
     61    """
     62    grok.viewletmanager(MainArea)
     63    grok.context(ICourse)
     64    grok.view(Index)
     65    grok.order(2)
     66
     67    def render(self):
     68        return '''<h5>%s</h5><h4>%s</h4><h3>%s</h3>''' % (
     69            getName(self.context.__parent__.__parent__.__parent__),
     70            getName(self.context.__parent__.__parent__),
     71            self.context.title)
     72       
    5773class ManageForm(grok.EditForm):
    5874    """Manage the basic properties of a `Course` instance.
Note: See TracChangeset for help on using the changeset viewer.