summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-01-25 18:17:02 +0100
committeremkael <emkael@tlen.pl>2019-01-25 18:17:02 +0100
commit6e090383ea1b561af29e696f3f56950d5c4e9ad5 (patch)
tree9ad0974269f192fd06da9f94d6aabaed093b8fe0
parent7a654d9a863a6982089bad3c5fc672b3255a20d6 (diff)
Finishing position captions in tooltips
-rw-r--r--jfr_playoff/generator.py9
-rw-r--r--jfr_playoff/template.py10
2 files changed, 18 insertions, 1 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py
index 8bdb2d8..f1e2829 100644
--- a/jfr_playoff/generator.py
+++ b/jfr_playoff/generator.py
@@ -269,6 +269,7 @@ class PlayoffGenerator(object):
boxes = ''
order = 0
for place in sorted(positions):
+ caption = self.get_caption_for_finishing_position(place)
boxes += self.p_temp.get(
'FINISHING_POSITION_BOX',
self.page['margin'] / 2 + int(float(order) / float(len(positions)) * dimensions[1]),
@@ -276,7 +277,7 @@ class PlayoffGenerator(object):
place,
' '.join([str(p) for p in position_info[place]['winner']]),
' '.join([str(p) for p in position_info[place]['loser']]),
- self.p_temp.get('POSITION_BOX', place))
+ self.p_temp.get('CAPTIONED_POSITION_BOX', caption, place) if caption else self.p_temp.get('POSITION_BOX', place))
order += 1
return boxes
@@ -356,6 +357,12 @@ class PlayoffGenerator(object):
)
)
+ def get_caption_for_finishing_position(self, position):
+ for style in self.leaderboard_classes:
+ if position in style['positions']:
+ return style['caption']
+ return None
+
def get_leaderboard_row_class(self, position):
classes = []
for style in self.leaderboard_classes:
diff --git a/jfr_playoff/template.py b/jfr_playoff/template.py
index a33afcc..fdfc107 100644
--- a/jfr_playoff/template.py
+++ b/jfr_playoff/template.py
@@ -107,6 +107,16 @@ class PlayoffTemplateStrings(object):
</table>
'''
+ CAPTIONED_POSITION_BOX = '''
+ <table border="0" cellspacing="0">
+ <tr>
+ <td class="bdc12" width="20">
+ <a onmouseover="Tip('%s')" onmouseout="UnTip()">%d</a>
+ </td>
+ </tr>
+ </table>
+ '''
+
MATCH_BOX = '''
<div style="text-align: center; position: absolute; left: %dpx; top: %dpx" data-id="%d" data-winner="%s" data-loser="%s" data-place-winner="%s" data-place-loser="%s" class="playoff_matchbox">
%s