- Timestamp:
- 6 Jan 2010, 03:52:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser/layout.py
r4649 r4692 16 16 17 17 grok.templatedir('templates') 18 19 # The list of primary navigation tabs.20 # Each entry is a tuple21 #22 # (<id_number>, <order_number>, <text_to_render>, <link_target>)23 #24 # where id number is the number pages can use as their pnav attribute,25 # order number determines the order in which the primary tabs are26 # rendered, text_to_render gives the text displayed and link_target27 # says, what url (relative to application URL) the tab should link to.28 #29 PRIMARY_NAV = [30 (0, 0, u'Home', ''),31 (1, 1, u'Faculties', '/faculties'),32 (2, 2, u'Search', '/search'),33 ]34 18 35 19 class UtilityView(object): … … 111 95 grok.context(IWAeUPObject) 112 96 113 def getPrimaryNav(self, view):114 """Get an ordered list of primary navigation entries.115 116 Each is a dict with keys117 118 'url': <link-target>119 'active' : <value for HTML class attribute: 'active' or ''120 'title': <text to be rendered in menu tab>121 'order': <num indicating order num of this entry>122 123 Pages attatched to this layout can provide an attribute 'pnav'124 to indicate, to which tab they belong. This tab will then be125 rendered 'active'.126 """127 result = []128 app_url = view.application_url()129 for item in PRIMARY_NAV:130 active = ''131 pnav = getattr(view, 'pnav', 0)132 if pnav == item[0]:133 active = 'active'134 url = app_url + item[3]135 result.append(136 dict(title=item[2],137 url=url,138 order=item[1],139 active=active)140 )141 return sorted(result, key=lambda x: x['order'])142 143 97 def isAuthenticated(self): 144 98 """Return True if the calling user is authenticated.
Note: See TracChangeset for help on using the changeset viewer.