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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/breadcrumbs.py

  • Committer: William Grant
  • Date: 2010-07-29 11:34:44 UTC
  • Revision ID: grantw@unimelb.edu.au-20100729113444-ht6s5kdcixvfubhr
Merge video and audio handlers, and reword them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
    @property
39
39
    def text(self):
40
 
        return self.context.nick
 
40
        perms = self.context.get_permissions(self.req.user, self.req.config)
 
41
        # Show nickname iff current user has permission to view this user
 
42
        # (Else, show just the login name)
 
43
        if 'view' in perms:
 
44
            return self.context.nick
 
45
        else:
 
46
            return self.context.login
41
47
 
42
48
    @property
43
49
    def extra_breadcrumbs_before(self):
44
50
        return [UsersBreadcrumb()]
45
51
 
46
52
 
 
53
class SubjectsBreadcrumb(object):
 
54
    @property
 
55
    def url(self):
 
56
        return '/subjects'
 
57
 
 
58
    @property
 
59
    def text(self):
 
60
        return 'Subjects'
 
61
 
47
62
class SubjectBreadcrumb(object):
48
63
    def __init__(self, req, context):
49
64
        self.req = req
50
65
        self.context = context
51
66
 
52
67
    @property
 
68
    def url(self):
 
69
        return self.req.publisher.generate(self.context)
 
70
 
 
71
    @property
53
72
    def text(self):
54
73
        return self.context.name
55
74
 
 
75
    @property
 
76
    def extra_breadcrumbs_before(self):
 
77
        return [SubjectsBreadcrumb()]
 
78
 
56
79
 
57
80
class OfferingBreadcrumb(object):
58
81
    def __init__(self, req, context):
65
88
 
66
89
    @property
67
90
    def text(self):
68
 
        return '%s semester %s' % (self.context.semester.year,
69
 
                                   self.context.semester.semester)
 
91
        return '%s %s' % (self.context.semester.year,
 
92
                          self.context.semester.display_name)
70
93
 
71
94
 
72
95
class ProjectsBreadcrumb(object):
73
 
    """Static 'Projects' breadcrumb to precede ProjectBreadcrumb."""
 
96
    """Static 'Projects' breadcrumb to precede ProjectBreadcrumb.
 
97
    context must be a ProjectSet.
 
98
    """
74
99
    def __init__(self, req, context):
75
100
        self.req = req
76
101
        self.context = context
77
102
 
78
103
    @property
79
104
    def url(self):
80
 
        return self.req.publisher.generate(self.context, None, '+projects')
 
105
        return self.req.publisher.generate(self.context.offering, None,
 
106
                                           '+projects')
81
107
 
82
108
    @property
83
109
    def text(self):
99
125
 
100
126
    @property
101
127
    def extra_breadcrumbs_before(self):
102
 
        return [ProjectsBreadcrumb(self.req, self.context.project_set.offering)]
 
128
        return [ProjectsBreadcrumb(self.req, self.context.project_set)]
103
129
 
104
130
 
105
131
class EnrolmentsBreadcrumb(object):