~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/xhtml.py

  • Committer: William Grant
  • Date: 2010-01-30 01:49:18 UTC
  • mfrom: (1465.1.2 exercise-breadcrumbs)
  • Revision ID: grantw@unimelb.edu.au-20100130014918-bn9i82pp30hin59r
Add an 'Exercises' breadcrumb before the exercise name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        ctx['title_img'] = media_url(req, CorePlugin,
107
107
                                     "images/chrome/root-breadcrumb.png")
108
108
        try:
109
 
            ctx['ancestry'] = self.get_context_ancestry(req)
 
109
            ancestry = self.get_context_ancestry(req)
110
110
        except NoPath:
111
 
            ctx['ancestry'] = []
 
111
            ancestry = []
 
112
 
 
113
        crumber = Breadcrumber(req)
 
114
 
 
115
        ctx['breadcrumbs'] = []
 
116
        for ancestor in ancestry:
 
117
            crumb = crumber.crumb(ancestor)
 
118
            if crumb is None:
 
119
                continue
 
120
 
 
121
            if hasattr(crumb, 'extra_breadcrumbs_before'):
 
122
                ctx['breadcrumbs'].extend(crumb.extra_breadcrumbs_before)
 
123
            ctx['breadcrumbs'].append(crumb)
 
124
            if hasattr(crumb, 'extra_breadcrumbs_after'):
 
125
                ctx['breadcrumbs'].extend(crumb.extra_breadcrumbs_after)
112
126
 
113
127
        # If the view has specified text for a breadcrumb, add one.
114
128
        if self.breadcrumb_text:
115
 
            ctx['extra_breadcrumbs'] = [ViewBreadcrumb(req, self)]
116
 
        else:
117
 
            ctx['extra_breadcrumbs'] = []
 
129
            ctx['breadcrumbs'].append(ViewBreadcrumb(req, self))
118
130
 
119
131
        # Allow the view to add its own fake breadcrumbs.
120
 
        ctx['extra_breadcrumbs'] += self.extra_breadcrumbs
 
132
        ctx['breadcrumbs'].extend(self.extra_breadcrumbs)
121
133
 
122
 
        ctx['crumb'] = Breadcrumber(req).crumb
123
134
        self.populate_headings(req, ctx)
124
135
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
125
136
                                                        'ivle-headings.html'))