From c44ff3f4a0f7d2084dd0296dd96682e3b7fd2629 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 21 Mar 2015 15:40:09 -0400 Subject: [PATCH] Convert the player_info page. Geez that was a huge one. I'll have to refactor this one later. In particular the tab content is long and convoluted. It is a good candidate for moving into a separate template, which can then be used with a namespace. --- xonstat/static/css/app.css | 6 +- xonstat/templates/player_info.mako | 461 ++++++++++++++--------------- 2 files changed, 231 insertions(+), 236 deletions(-) diff --git a/xonstat/static/css/app.css b/xonstat/static/css/app.css index 963eb14..8202e04 100644 --- a/xonstat/static/css/app.css +++ b/xonstat/static/css/app.css @@ -24,7 +24,7 @@ h1, h2, h3, h4, h5 { p { color: #C3C3C3; - font-size: 1.3rem; + font-size: 1.2rem; } hr { @@ -215,3 +215,7 @@ table thead tr th, table thead tr td, table tr th, table tr td { .eloneutral { color: gray; } + +.tabs-content { + margin-bottom: 0; +} diff --git a/xonstat/templates/player_info.mako b/xonstat/templates/player_info.mako index f9711b4..8f79859 100644 --- a/xonstat/templates/player_info.mako +++ b/xonstat/templates/player_info.mako @@ -2,212 +2,202 @@ <%namespace name="nav" file="nav.mako" /> <%block name="navigation"> -% if player.email_addr is not None: -${nav.nav('players', True)} -% else: -${nav.nav('players', False)} -% endif + % if player.email_addr is not None: + ${nav.nav('players', True)} + % else: + ${nav.nav('players', False)} + % endif <%block name="css"> -${parent.css()} - - + ${parent.css()} + + <%block name="js"> -${parent.js()} - - - + + - - + // weapon accuracy and damage charts + google.load('visualization', '1.1', {packages: ['corechart']}); + $.getJSON("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20})}", function(data) { + if(data.games.length < 5) { + d3.select(".row #damageChart").remove(); + d3.select(".row #accuracyChart").remove(); + } + drawDamageChart(data); + drawAccuracyChart(data); + }); + + + <%block name="title"> -Player Information + Player Information
-
-

- ${player.nick_html_colors()|n} -

-

+
+

${player.nick_html_colors()|n}

+
Joined ${player.joined_pretty_date()} (player #${player.player_id}) % if cake_day: - + % endif -
+

+
+##### TABS #####
-
-
+
+ +
+
- Playing Time: ${overall_stats[g.game_type_cd].total_playing_time}
+
+ % for g in games_played: +
- % if g.game_type_cd in fav_maps: - Favorite Map: ${fav_maps[g.game_type_cd].map_name}
- % else: -
- % endif + ##### LEFT PANE ##### +
+

+ % if g.game_type_cd in overall_stats: + Last Played: ${overall_stats[g.game_type_cd].last_played_fuzzy}
+ % else: +
+ % endif - % if g.game_type_cd == 'ctf': - % if overall_stats[g.game_type_cd].total_captures is not None: - Fastest flag captures...
- % else: -
- % endif - % else: -
- % endif + Games Played: + % if g.game_type_cd == 'overall': + + % else: + + % endif + ${g.games}
+ + Playing Time: ${overall_stats[g.game_type_cd].total_playing_time}
+ + % if g.game_type_cd in fav_maps: + Favorite Map: ${fav_maps[g.game_type_cd].map_name}
+ % else: +
+ % endif + % if g.game_type_cd == 'ctf': + % if overall_stats[g.game_type_cd].total_captures is not None: + Fastest flag captures...
+ % else: +
+ % endif + % else: +
+ % endif

-
+ + ##### RIGHT PANE ##### +

- Win Percentage: ${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses)
+ Win Percentage: ${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses)
- % if g.game_type_cd in overall_stats: - % if overall_stats[g.game_type_cd].k_d_ratio is not None: - Kill Ratio: ${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths)
- % endif - % else: -
- % endif + % if g.game_type_cd in overall_stats: + % if overall_stats[g.game_type_cd].k_d_ratio is not None: + Kill Ratio: ${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths)
+ % endif + % else: +
+ % endif - % if g.game_type_cd in elos: - % if g.game_type_cd == 'overall': - Best Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games)
- % else: - Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games)
- % endif - % else: -
- % endif + % if g.game_type_cd in elos: + % if g.game_type_cd == 'overall': + Best Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games)
+ % else: + Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games)
+ % endif + % else: +
+ % endif - % if g.game_type_cd in ranks: - % if g.game_type_cd == 'overall': - Best Rank: - - - ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} - - (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)}) -
-
- % else: - Rank: - - - ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} - - (percentile: ${round(ranks[g.game_type_cd].percentile,2)}) -
-
- % endif - % else: -
- % endif + % if g.game_type_cd in ranks: + % if g.game_type_cd == 'overall': + Best Rank: + + + ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} + + (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)}) +
+
+ % else: + Rank: + + + ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} + + (percentile: ${round(ranks[g.game_type_cd].percentile,2)}) +
+
+ % endif + % else: +
+ % endif - % if g.game_type_cd == 'ctf': - % if overall_stats[g.game_type_cd].cap_ratio is not None: - Cap Ratio: ${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups)
- % else: -
- % endif - % else: -
- % endif + % if g.game_type_cd == 'ctf': + % if overall_stats[g.game_type_cd].cap_ratio is not None: + Cap Ratio: ${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups)
+ % else: +
+ % endif + % else: +
+ % endif

-
- % endif - % endfor
-
-
-
-
- -
+ % endfor
- -##### Weapon Accuracy Chart #### +##### ACCURACY CHART ####
-
+

Weapon Accuracy

-
- +
+
-##### Weapon Damage Chart #### +##### DAMAGE CHART ####
-
+

Weapon Damage

-
- - +
+ ##### RECENT GAMES (v2) #### % if recent_games: -
-
-

Recent Games

- - - - - - - - - - - - - - % for rg in recent_games: - - - - - - - - - - % endfor - -
TypeServerMapResultPlayedElo
view${rg.server_name}${rg.map_name} - % if rg.team != None: - % if rg.team == rg.winner: - Win - % else: - Loss - % endif - % else: - % if rg.rank == 1: - Win - % else: - Loss (#${rg.rank}) - % endif - % endif - ${rg.fuzzy_date} - - % if rg.elo_delta is not None: - % if round(rg.elo_delta,2) > 0: - +${round(rg.elo_delta,2)} - % elif round(rg.elo_delta,2) < 0: - ${round(rg.elo_delta,2)} - % else: - - % endif - % else: - - % endif - -
- % if total_games > 10: -

More...

- % endif +
+
+

Recent Games

+ + + + + + + + + + + + + + % for rg in recent_games: + + + + + + + + + + % endfor + +
TypeServerMapResultPlayedElo
view${rg.server_name}${rg.map_name} + % if rg.team != None: + % if rg.team == rg.winner: + Win + % else: + Loss + % endif + % else: + % if rg.rank == 1: + Win + % else: + Loss (#${rg.rank}) + % endif + % endif + ${rg.fuzzy_date} + + % if rg.elo_delta is not None: + % if round(rg.elo_delta,2) > 0: + +${round(rg.elo_delta,2)} + % elif round(rg.elo_delta,2) < 0: + ${round(rg.elo_delta,2)} + % else: + + % endif + % else: + + % endif + +
+ + % if total_games > 10: +

+ More... +

+ % endif + +
-
% endif -- 2.39.2