Changeset 4432 for waeup/branches
- Timestamp:
- 25 Jul 2009, 11:06:38 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/tables.py
r4431 r4432 2 2 """ 3 3 import grok 4 from waeup.interfaces import IUniversity, IFaculty, IDepartment 4 from waeup.interfaces import (IUniversity, IFacultyContainer, IFaculty, 5 IDepartment) 5 6 from waeup.widgets.interfaces import ITableProvider 6 7 from waeup.widgets.table import YUITable as Table 7 8 from waeup.widgets.table import Col 8 9 9 class DepartmentTableProvider(grok.Adapter):10 grok. context(IFaculty)10 class CodeAndTitleTableProvider(grok.Adapter): 11 grok.baseclass() 11 12 grok.provides(ITableProvider) 12 13 13 title = 'Departments' 14 15 def __init__(self, context): 16 self.context = context 14 title = None 17 15 18 16 def getTable(self, view=None): 19 17 data = self.context 18 context_url = '' 19 if view: 20 context_url = view.url(self.context) + '/' 20 21 cols = ( 21 22 Col( 22 23 header='Code', sortable=True, 23 data = tuple(['<a href="%s">%s</a>' % ( 24 data[x].code, data[x].code) for x in data])), 24 data = tuple(['<a href="%s%s">%s</a>' % ( 25 context_url, data[x].code, 26 data[x].code) for x in data])), 25 27 Col( 26 28 header='Title', sortable=True, … … 29 31 self.table = Table(self.title, cols=cols) 30 32 return self.table 33 34 class DepartmentTableProvider(CodeAndTitleTableProvider): 35 grok.context(IFaculty) 36 grok.provides(ITableProvider) 37 title = 'Departments' 38
Note: See TracChangeset for help on using the changeset viewer.