~launchpad-pqm/launchpad/devel

9436.2.1 by Barry Warsaw
Convert ~team/+invitations to UI 3.0.
1
=====================
2
Team membership views
3
=====================
4
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
5
6
Breadcrumbs
7
-----------
8
9
Team membership breadcrumbs uses the member's displayname to create
10
"<displayname>'s membership".
11
14606.4.9 by William Grant
Merge canonical.lazr's menu testing stuff to lp.testing.menu.
12
    >>> from lp.testing.menu import make_fake_request
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
13
    >>> from lp.registry.interfaces.teammembership import ITeamMembershipSet
14
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
15
    >>> team_owner = factory.makePerson(name='team-owner')
16
    >>> super_team = factory.makeTeam(name='us', owner=team_owner)
17
    >>> membership_set = getUtility(ITeamMembershipSet)
18
    >>> membership = membership_set.getByPersonAndTeam(
19
    ...     team_owner, super_team)
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
20
    >>> view = create_view(membership, '+index')
21
22
    >>> request = make_fake_request(
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
23
    ...     'http://launchpad.dev/~us/+member/team-owner',
24
    ...     [super_team, membership, view])
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
25
    >>> hierarchy = create_initialized_view(
26
    ...     membership, '+hierarchy', request=request)
27
    >>> hierarchy.items
28
    [<TeamBreadcrumb ... text='\u201cUs\u201d team'>,
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
29
     <TeamMembershipBreadcrumb ... text='Team-owner's membership'>]
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
30
31
32
+member view
33
------------
34
35
The TeamMembershipEditView provides a label that described the membership
36
state of the IPerson.
37
38
    >>> view = create_view(membership, '+index')
39
    >>> print view.label
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
40
    Active member Team-owner
9644.5.2 by Curtis Hovey
Added TeamMembershipBreadcrumb to provide breacrumbs for ~<team>/+member.
41
42
43
+invitations view
44
-----------------
45
9436.2.1 by Barry Warsaw
Convert ~team/+invitations to UI 3.0.
46
When a team is invited to join another team, the TeamInvitationsView controls
47
the ~team/+invitations page.
48
49
    >>> team = factory.makeTeam(displayname='Bassists', name='bassists')
50
    >>> view = create_initialized_view(team, '+invitations')
51
    >>> print view.label
52
    Invitations for Bassists
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
53
54
55
+invitation/<team> view
56
-----------------------
57
9644.5.6 by Curtis Hovey
Fixed grammar
58
The TeamInvitationView allows a team admin to accept or decline an invitation
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
59
to join another team. The invitation is a TeamMembership instance. The view
60
is applied during the stepto traversal--it is not a named view in ZCML.
61
14097.1.2 by Steve Kowalik
Shift TeamJoinMixin and userIsActiveTeamMember to a new module, teamjoin.
62
    >>> from lp.registry.browser.team import TeamInvitationView
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
63
64
    >>> login_person(team_owner)
10002.2.27 by Edwin Grubbs
Simplistic changes to ignore new return values for addMember() and setStatus().
65
    >>> ignored = super_team.addMember(team, team_owner)
9644.5.3 by Curtis Hovey
Updated TeamInvitationView to define an page_title that describes the intent better than the the breadcrumb.
66
    >>> membership = membership_set.getByPersonAndTeam(team, super_team)
67
    >>> login_person(team.teamowner)
68
    >>> view = TeamInvitationView(membership, request)
69
    >>> print view.label
70
    Make Bassists a member of Us
71
72
The view provides page_title to create a breadcrumb that describes this
73
use the TeamMembership.
74
75
    >>> print view.page_title.encode('ascii', 'backslashreplace')
76
    \u201cUs\u201d team invitation