From a2c64fe7c0e6a288c28ec5df7367288a372d1f0e Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 18 Aug 2013 09:47:18 -0400 Subject: [PATCH] Refactor the presentation of the accuracy graph. --- xonstat/templates/accuracy_graph.mako | 35 ++++++++++++++ xonstat/templates/player_info.mako | 68 ++------------------------- 2 files changed, 38 insertions(+), 65 deletions(-) create mode 100644 xonstat/templates/accuracy_graph.mako diff --git a/xonstat/templates/accuracy_graph.mako b/xonstat/templates/accuracy_graph.mako new file mode 100644 index 0000000..8458b77 --- /dev/null +++ b/xonstat/templates/accuracy_graph.mako @@ -0,0 +1,35 @@ +<%def name="accuracy_graph(recent_weapons)"> +### hitscan weapon data is available +% if 'nex' in recent_weapons or 'rifle' in recent_weapons or 'minstanex' in recent_weapons or 'uzi' in recent_weapons or 'shotgun' in recent_weapons: +
+
+

Accuracy

+ +
+
+ +
+
    + % for weapon in ['nex', 'rifle', 'minstanex', 'uzi', 'shotgun']: + % if weapon in recent_weapons: +
  • + ### the nex is underscored first by default (until user selection) + % if weapon == 'nex': +
    + % else: +
    + % endif + +

    ${weapon}

    + +
    +
  • + % endif + % endfor +
+
+ +
+
+% endif + diff --git a/xonstat/templates/player_info.mako b/xonstat/templates/player_info.mako index 677c058..293d1d5 100644 --- a/xonstat/templates/player_info.mako +++ b/xonstat/templates/player_info.mako @@ -1,6 +1,7 @@ <%inherit file="base.mako"/> <%namespace name="nav" file="nav.mako" /> <%namespace file="accuracy.mako" import="accuracy" /> +<%namespace file="accuracy_graph.mako" import="accuracy_graph" /> <%block name="navigation"> ${nav.nav('players')} @@ -331,71 +332,8 @@ Player Information -% if 'nex' in recent_weapons or 'rifle' in recent_weapons or 'minstanex' in recent_weapons or 'uzi' in recent_weapons or 'shotgun' in recent_weapons: -
-
-

Accuracy

-
-
- -
-
    - % if 'nex' in recent_weapons: -
  • -
    - -

    Nex

    - -
    -
  • - % endif - - % if 'rifle' in recent_weapons: -
  • -
    - -

    Rifle

    - -
    -
  • - % endif - - % if 'minstanex' in recent_weapons: -
  • -
    - -

    Minstanex

    - -
    -
  • - % endif - - % if 'uzi' in recent_weapons: -
  • -
    - -

    Uzi

    - -
    -
  • - % endif - - % if 'shotgun' in recent_weapons: -
  • -
    - -

    Shotgun

    - -
    -
  • - % endif -
-
- -
-
-% endif - +### ACCURACY GRAPH +${accuracy_graph(recent_weapons)} % if 'rocketlauncher' in recent_weapons or 'grenadelauncher' in recent_weapons or 'electro' in recent_weapons or 'crylink' in recent_weapons or 'laser' in recent_weapons:
-- 2.39.2