Merge lp:~mhall119/loco-team-portal/fixes-583913 into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Approved by: Chris Johnston
Approved revision: 137
Merged at revision: 137
Proposed branch: lp:~mhall119/loco-team-portal/fixes-583913
Merge into: lp:loco-team-portal
Diff against target: 43 lines (+10/-3)
2 files modified
loco_directory/teams/views.py (+7/-0)
loco_directory/templates/teams/team_detail.html (+3/-3)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/fixes-583913
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Chris Johnston Approve
Review via email: mp+26300@code.launchpad.net

Description of the change

Only display 'Edit Details', 'Add Event' and 'Join this team' links when appropriate given the user's status.

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) wrote :

Looks good!

review: Approve
Revision history for this message
Daniel Holbach (dholbach) wrote :

Great work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/teams/views.py'
2--- loco_directory/teams/views.py 2010-05-17 14:28:41 +0000
3+++ loco_directory/teams/views.py 2010-05-28 13:13:34 +0000
4@@ -74,8 +74,15 @@
5
6 def team_detail(request, team_slug):
7 team_object = get_object_or_404(Team, lp_name=team_slug)
8+ is_member = False
9+ is_admin = False
10+ if request.user.is_authenticated():
11+ is_member = launchpad.is_team_member(request.user, team_object)
12+ is_admin = launchpad.is_admin_or_owner(request.user.username, team_object)
13 context = {
14 'team': team_object,
15+ 'is_member' : is_member,
16+ 'is_admin' : is_admin,
17 }
18 return render_to_response('teams/team_detail.html',
19 context, RequestContext(request))
20
21=== modified file 'loco_directory/templates/teams/team_detail.html'
22--- loco_directory/templates/teams/team_detail.html 2010-05-04 05:58:12 +0000
23+++ loco_directory/templates/teams/team_detail.html 2010-05-28 13:13:34 +0000
24@@ -17,8 +17,8 @@
25 <div id="options-right">
26 {% if user.is_authenticated %}
27 <ul>
28- <li><a class="option edit" href="{% url team-edit team.lp_name %}" title="{% trans "Edit team details." %}">&nbsp;</a></li>
29- <li><a class="option add-team-event" href="{% url team-event-new team.lp_name %}" title="{% trans "Add new Event." %}">&nbsp;</a></li>
30+ {% if is_admin %}<li><a class="option edit" href="{% url team-edit team.lp_name %}" title="{% trans "Edit team details." %}">&nbsp;</a></li>{% endif %}
31+ {% if is_member %}<li><a class="option add-team-event" href="{% url team-event-new team.lp_name %}" title="{% trans "Add new Event." %}">&nbsp;</a></li>{% endif %}
32 </ul>
33 {% endif %}
34 </div>
35@@ -40,7 +40,7 @@
36 </tr>
37 <tr>
38 <th scope="row"><label>{% trans "Launchpad Page:" %}</label></th>
39- <td><a href="https://launchpad.net/~{{ team.lp_name }}">{{ team.name }}</a> (<a href="https://launchpad.net/~{{ team.lp_name }}/+join">{% trans "Join this team!" %}</a>)</td>
40+ <td><a href="https://launchpad.net/~{{ team.lp_name }}">{{ team.name }}</a>{% if is_member %}{% else %} (<a href="https://launchpad.net/~{{ team.lp_name }}/+join">{% trans "Join this team!" %}</a>){% endif %}</td>
41 </tr>
42
43 <tr>

Subscribers

People subscribed via source and target branches