Changeset 4433 for waeup/branches


Ignore:
Timestamp:
25 Jul 2009, 11:09:11 (15 years ago)
Author:
uli
Message:

Move faculty table provider to new module.

Location:
waeup/branches/ulif-rewrite/src/waeup
Files:
2 edited

Legend:

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

    r4432 r4433  
    3737    title = 'Departments'
    3838
     39class FacultyTableProvider(CodeAndTitleTableProvider):
     40    grok.context(IFacultyContainer)
     41    grok.provides(ITableProvider)
     42    title = 'Faculties'
  • waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.py

    r4412 r4433  
    1111                            FormWrapMixin)
    1212from waeup.widgets.interfaces import ITableProvider
    13 from waeup.widgets.table import Col, YUITable
    1413
    1514class FacultyContainer(grok.Container):
     
    160159    def render(self):
    161160        return u'<div class="portlet"><a href="manage">Manage faculties</a></div>'
    162 
    163 class FacultyTableProvider(grok.Adapter):
    164     grok.context(IFacultyContainer)
    165     grok.provides(ITableProvider)
    166 
    167     def __init__(self, context):
    168         self.context = context
    169         data = self.context
    170         cols = (
    171             Col(
    172                 header='Code', sortable=True,
    173                 data = tuple(['<a href="%s">%s</a>' % (
    174                             data[x].code, data[x].code) for x in data])),
    175             Col(
    176                 header='Title', sortable=True,
    177                 data = tuple([data.getName(x) for x in data])),
    178                 )
    179         self.table = YUITable('Faculties', cols=cols)
    180 
    181     def getTable(self):
    182         return self.table
Note: See TracChangeset for help on using the changeset viewer.