From: Ant Zucaro Date: Fri, 19 Apr 2013 00:30:55 +0000 (-0400) Subject: Fix the broken things in player_game_index. X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonstat.git;a=commitdiff_plain;h=371e4d7ce59cbe02aa409604ecc7e70d5626d965 Fix the broken things in player_game_index. - New routes were defined (/player/:id/game_type_cd) when a query parameter is the better fit. Game types are a filter condition on the resource, not the resource itself, thus should not be in the route. - Pagination was broken. Passing search_query to route_url makes the query parameters persist, although I pass query parameters in an awful way that needs to be fixed. - Multiple lines just to show the game type description when an if statement would do the same thing. - No need to pass the player_url to the template. You can reverse- generate URLs to routes with route_url just fine. - Remove the extra link back to the player_info page, as the pattern throughout the rest of the application is to click the nick itself. --- diff --git a/xonstat/__init__.py b/xonstat/__init__.py index 474c162..6f3b9d6 100644 --- a/xonstat/__init__.py +++ b/xonstat/__init__.py @@ -41,11 +41,6 @@ def main(global_config, **settings): config.add_view(player_game_index, route_name="player_game_index", renderer="player_game_index.mako") config.add_view(player_game_index_json, route_name="player_game_index_json", renderer="jsonp") - config.add_route("player_game_index_filtered", "/player/{player_id:\d+}/games/{game_type_cd:\w+}") - config.add_route("player_game_index_filtered_json", "/player/{player_id:\d+}/games/{game_type_cd:\w+}.json") - config.add_view(player_game_index, route_name="player_game_index_filtered", renderer="player_game_index.mako") - config.add_view(player_game_index_json, route_name="player_game_index_filtered_json", renderer="jsonp") - config.add_route("player_info", "/player/{id:\d+}") config.add_route("player_info_json", "/player/{id:\d+}.json") config.add_view(player_info, route_name="player_info", renderer="player_info.mako") diff --git a/xonstat/templates/player_game_index.mako b/xonstat/templates/player_game_index.mako index c2fd6ce..f02a6b3 100644 --- a/xonstat/templates/player_game_index.mako +++ b/xonstat/templates/player_game_index.mako @@ -16,25 +16,30 @@ Recent Games % if not games: - % if not game_type_cd: -

Sorry, no games yet. Get playing!

- % else: -

Sorry, no ${game_type_cd.upper()} games yet. Get playing!

- % endif +

Sorry, no + % if game_type_descr: + ${game_type_descr} + % endif + games yet for + ${player.nick_html_colors()|n}. Get playing! +

Back to player info page

% else:
- % if not game_type_cd: -

Recent Games by ${player.nick_html_colors()|n}

- % else: -

Recent ${game_type_cd.upper()} Games by ${player.nick_html_colors()|n}

- % endif -

Back to player info page

+

Recent + % if game_type_descr: + ${game_type_descr} + % endif + Games by + + ${player.nick_html_colors()|n} + +

-
+