Merge lp:~mhall119/loco-team-portal/fix-509675-and-add-team-event into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mhall119/loco-team-portal/fix-509675-and-add-team-event
Merge into: lp:loco-team-portal
Diff against target: 106 lines (+30/-5)
6 files modified
loco_directory/events/urls.py (+1/-0)
loco_directory/events/views.py (+13/-0)
loco_directory/templates/events/event_list.html (+3/-0)
loco_directory/templates/events/team_event_detail_attendees.inc.html (+0/-4)
loco_directory/templates/events/team_event_new.html (+1/-1)
loco_directory/templates/events/team_event_new_select.html (+12/-0)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/fix-509675-and-add-team-event
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+17749@code.launchpad.net

This proposal supersedes a proposal from 2010-01-20.

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

To make the interface more intuitive, I added a link on the Events page to add a new Team Event. If the user is not listed as an admin on any team, they are told they cannot add a new team event, and redirected to the events list. If they are the admin on more than one team, they are shown a list of team links they can add an Event for. If they are the admin on only one team, they are redirected to that team's add event page.

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

Good 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/events/urls.py'
2--- loco_directory/events/urls.py 2010-01-11 22:24:24 +0000
3+++ loco_directory/events/urls.py 2010-01-20 15:47:13 +0000
4@@ -12,6 +12,7 @@
5 url(r'^team/(?P<team_event_id>\d+)/update/$', 'events.views.team_event_update', name='team-event-update'),
6 url(r'^team/(?P<team_event_id>\d+)/comment/$', 'events.views.team_event_comment_new', name='team-event-comment-new'),
7 url(r'^team/(?P<team_slug>[a-zA-Z0-9\-\.\+?]+)/add/$', 'events.views.team_event_new', name='team-event-new'),
8+ url(r'^team/add/$', 'events.views.team_event_select', name='team-event-select'),
9 #global events
10 url(r'^global/ical/$', 'events.views.global_event_list_ical', name='global-event-list-ical'),
11 url(r'^global/(?P<global_event_id>\d+)/detail/$', 'events.views.global_event_detail', name='global-event-detail'),
12
13=== modified file 'loco_directory/events/views.py'
14--- loco_directory/events/views.py 2010-01-18 14:41:22 +0000
15+++ loco_directory/events/views.py 2010-01-20 15:47:13 +0000
16@@ -127,6 +127,18 @@
17 return redirect( team_event_object )
18
19 @login_required
20+def team_event_select(request):
21+ teams = Team.objects.filter(admins__lpid=request.user.username)
22+ if len(teams) == 0:
23+ request.user.message_set.create(message=_('You can not add a new team event'))
24+ return redirect( 'event-list' )
25+ elif len(teams) == 1:
26+ return redirect('team-event-new', teams[0].lp_name)
27+ else:
28+ context = {'teams': teams}
29+ return render_to_response('events/team_event_new_select.html', context, RequestContext(request))
30+
31+@login_required
32 def team_event_new(request, team_slug):
33 """
34 new team event
35@@ -189,6 +201,7 @@
36 request.user.message_set.create(message=_('You can not update this team event.'))
37 return redirect( team_event_object )
38
39+@login_required
40 def team_event_register(request, team_event_id):
41 """
42 register as attendee for a team event
43
44=== modified file 'loco_directory/templates/events/event_list.html'
45--- loco_directory/templates/events/event_list.html 2010-01-11 22:24:24 +0000
46+++ loco_directory/templates/events/event_list.html 2010-01-20 15:47:13 +0000
47@@ -24,6 +24,9 @@
48
49 <h1>{% trans "Ubuntu LoCo Team Events" %}{% if team_event_list %} <a title="{% trans "Team Events as ical" %}" class="team_event_ical" href="{% url team-event-list-ical %}"></a>{% endif %}</h1>
50 {% if team_event_list %}
51+{% if user.is_authenticated %}
52+ <p><b><a href="{% url team-event-select %}">{% trans "Add new Team Event." %}</a></b></p>
53+{% endif %}
54 <p>{% trans "Select a team event below to see more information about it:" %}</p>
55
56 {% include "events/team_event_list.inc.html" %}
57
58=== modified file 'loco_directory/templates/events/team_event_detail_attendees.inc.html'
59--- loco_directory/templates/events/team_event_detail_attendees.inc.html 2010-01-11 12:41:30 +0000
60+++ loco_directory/templates/events/team_event_detail_attendees.inc.html 2010-01-20 15:47:13 +0000
61@@ -1,15 +1,11 @@
62 {% load i18n %}
63 <table>
64 <tr><td colspan="2">
65-{% if user.is_authenticated %}
66 {% if user_is_attending %}
67 <a href="{% url team-event-register team_event_object.id %}">{% trans 'Change your Registration Status' %}</a>
68 {% else %}
69 <a href="{% url team-event-register team_event_object.id %}">{% trans 'Register for this Event' %}</a>
70 {% endif %}
71-{% else %}
72-{% blocktrans %}You must <a href="/openid/login">log in</a> to register for this event.{% endblocktrans %}
73-{% endif %}
74 </td></tr>
75 </table>
76 {% if team_event_object.attendee_set.all %}
77
78=== modified file 'loco_directory/templates/events/team_event_new.html'
79--- loco_directory/templates/events/team_event_new.html 2010-01-04 17:22:52 +0000
80+++ loco_directory/templates/events/team_event_new.html 2010-01-20 15:47:13 +0000
81@@ -8,7 +8,7 @@
82 {% endblock %}
83
84 {% block content %}
85-<h1>{% trans "Add new Team Event" %}</h1>
86+<h1>{% trans "Add new Team Event for " %}{{ team_object.name}}</h1>
87 <form action="." method="post">
88 <table>
89 {{ form.as_table }}
90
91=== added file 'loco_directory/templates/events/team_event_new_select.html'
92--- loco_directory/templates/events/team_event_new_select.html 1970-01-01 00:00:00 +0000
93+++ loco_directory/templates/events/team_event_new_select.html 2010-01-20 15:47:13 +0000
94@@ -0,0 +1,12 @@
95+{% extends "base.html" %}
96+{% load i18n %}
97+
98+{% block title %}{% trans "New Team Event" %}{% endblock %}
99+
100+{% block content %}
101+<h1>{% trans "Select a Team to add an Event for" %}</h1>
102+{% for team in teams %}
103+<h2><a href="{%url team-event-new team.lp_name%}">{{team.name}}</a></h2>
104+{% endfor %}
105+
106+{% endblock %}

Subscribers

People subscribed via source and target branches