Commits

Albert Hopkins committed 1f28626

Give slashes to all urls.

Comments (0)

Files changed (6)

djangoproject/airport/templates/airport/game_summary.html

     {% if game.state = 0 and players %}
             <td id="others" colspan="7">
                 {% for player in players %} 
-                <a href="{% url game_summary game.id %}?player={{ player.user.username }}">>{{ player.user.username }}</a>
+                <a href="{% url game_summary %}?id={{game.id}}?player={{player.user.username}}">>{{player.user.username}}</a>
                 {% endfor %}
             </td>
     {% else %}<td id="others" colspan="7">&nbsp;</td>

djangoproject/airport/templates/airport/games.js

 
     for (var i=0; i<data['games'].length; i++) {
         game = data['games'][i];
-        s = s + ('<tr><td><a class="games_join" href="{% url games_join %}' + game['id'] + '">' + game['id'] + '</a></td>' 
+        s = s + ('<tr><td><a class="games_join" href="{% url games_join %}?id=' + game['id'] + '">' + game['id'] + '</a></td>' 
                 + '<td>' + game['goals'] + '</td><'
                 + '<td>' + game['airports'] + '</td>'
                 + '<td>' + game['players'] + '</td>'

djangoproject/airport/templates/airport/games_stats.html

         <td class="stat_name">Hours / Game</td><td class="numeric">{{ avg_time|floatformat }}</td></tr>
 
         <tr><td>History</td>
-        <td colspan="3">{% for game in prior_games reversed %} <a href="{% url game_summary game.0 %}" title="{{ game.1 }}">{{ game.0 }}</a>{% endfor %}</td></tr>
+        <td colspan="3">{% for game in prior_games reversed %} <a href="{% url game_summary %}?id={{game.0}}" title="{{ game.1 }}">{{ game.0 }}</a>{% endfor %}</td></tr>
     </tbody>
 </table>

djangoproject/airport/templates/airport/home.js

 
     if (data['city']) {
         city_image_url = ('{% url city_image %}' 
-                          + encodeURIComponent(data['city']));
+                          + encodeURIComponent(data['city']) + '/');
         preload_image(city_image_url);
     }
 
     }
     $.ajax({
         type: 'POST',
-        url: "{% url pause_game game.id %}",
+        url: "{% url pause_game %}?id=" + "{{ game.id }}",
         success: callback
     });
 }
     event.preventDefault();
     $.ajax({
         type: 'POST',
-        url: "{% url rage_quit game.id %}",
+        url: "{% url rage_quit %}?id={{game.id}}",
         success: function() { window.location.replace('{% url games %}');}
     });
 }

djangoproject/airport/urls.py

     url(r'^info$', 'info', name='info'),
     url(r'^$', 'home', name='home'),
     url(r'^messages/$', 'messages', name='messages'),
-    url(r'^games/info$', 'games_info', name='games_info'),
-    url(r'^games/stats$', 'games_stats'),
-    url(r'^games/create$', 'games_create', name='games_create'),
-    url(r'^games/join/(\d+)?$', 'games_join', name='games_join'),
-    url(r'^games/pause/(\d+)$', 'pause_game', name='pause_game'),
-    url(r'^games/quit/(\d+)$', 'rage_quit', name='rage_quit'),
-    url(r'^games/summary/(\d+)$', 'game_summary', name='game_summary'),
+    url(r'^games/info/$', 'games_info', name='games_info'),
+    url(r'^games/stats/$', 'games_stats'),
+    url(r'^games/create/$', 'games_create', name='games_create'),
+    url(r'^games/join/$', 'games_join', name='games_join'),
+    url(r'^games/pause/$', 'pause_game', name='pause_game'),
+    url(r'^games/quit/$', 'rage_quit', name='rage_quit'),
+    url(r'^games/summary/$', 'game_summary', name='game_summary'),
     url(r'^games/$', 'games_home', name='games'),
     url(r'^images/cities/$', 'city_image', name='city_image'),
-    url(r'^images/cities/(.*)$', 'city_image'),
-    url(r'^crash$', 'crash'),
+    url(r'^images/cities/(.*)/$', 'city_image'),
+    url(r'^crash/$', 'crash'),
     url(r'^accounts/register/$', 'register', name='register'),
-    url(r'^about$', 'about')
+    url(r'^about/$', 'about')
 )

djangoproject/airport/views.py

     if not game:
         return json_redirect(reverse(games_home))
     if game.state == game.GAME_OVER or profile in game.finishers():
-        return json_redirect(reverse(game_summary, args=[str(game.id)]))
+        return json_redirect('%s?id=%s' % (reverse(game_summary), game.id))
     now, airport, ticket = game.update(profile)
 
     calc_mwp = game.players.distinct().count() * MW_PROBABILITY
 
 @require_http_methods(['POST'])
 @login_required
-def pause_game(request, game_id):
+def pause_game(request):
     """Pause/Resume game"""
+    game_id = request.GET.get('id', None)
     game = get_object_or_404(Game, id=game_id)
 
     if game.host == request.user.profile:
 
 @require_http_methods(['POST'])
 @login_required
-def rage_quit(request, game_id):
+def rage_quit(request):
     """Bail out of the game because you are a big wuss"""
+    game_id = request.GET.get('id', None)
     game = get_object_or_404(Game, id=game_id)
     game.remove_player(request.user.profile)
     Message.send(request.user.profile, 'You have quit %s. Wuss!' % game)
     return games_info(request)
 
 @login_required
-def games_join(request, game_id):
+def games_join(request):
     """Join a game.  Game must exist and have not ended (you can join a
     game that is in progress
     """
     profile = request.user.profile
 
+    game_id = request.GET.get('id', None)
     game = get_object_or_404(Game, id=game_id)
     if game.state == game.GAME_OVER:
         Message.send(
     return render_to_response('airport/games_stats.html', cxt)
 
 @login_required
-def game_summary(request, game_id):
+def game_summary(request):
     """Show summary for a particular game, request.user must have actually
     played the game to utilize this view"""
+    game_id = request.GET.get('id', None)
     game = get_object_or_404(Game, id=int(game_id))
 
     username = request.GET.get('player', None)