diff options
author | emkael <emkael@tlen.pl> | 2018-10-02 12:43:11 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-10-02 12:44:30 +0200 |
commit | 6119175f65c6bc12771a968cd72e6c8179848f78 (patch) | |
tree | 29203d0f6689798ce3e458f111af020f02de483f | |
parent | 62fe5244beb1a859b86aae86d784a86b30d86ca9 (diff) |
Templates and strings for new team label rendering method
-rw-r--r-- | jfr_playoff/generator.py | 6 | ||||
-rw-r--r-- | jfr_playoff/i18n.py | 4 | ||||
-rw-r--r-- | jfr_playoff/template.py | 8 |
3 files changed, 17 insertions, 1 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py index f2a2c55..fab6d0e 100644 --- a/jfr_playoff/generator.py +++ b/jfr_playoff/generator.py @@ -51,6 +51,12 @@ class PlayoffGenerator(object): 'PAGE_BODY_FOOTER', datetime.now().strftime('%Y-%m-%d o %H:%M:%S')))) + def __get_team_label(self, team_name, template='MATCH_TEAM_LABEL'): + if not self.page.get('predict_teams', None): + # override template if team predictions are not enabled + template = 'MATCH_TEAM_LABEL' + return self.p_temp.get(template, team_name) + def get_match_table(self, match): rows = '' for team in match.teams: diff --git a/jfr_playoff/i18n.py b/jfr_playoff/i18n.py index c4134a9..63576db 100644 --- a/jfr_playoff/i18n.py +++ b/jfr_playoff/i18n.py @@ -11,7 +11,9 @@ PLAYOFF_I18N_DEFAULTS = { 'STANDINGS_TEAM': 'drużyna', 'STANDINGS_CAPTIONS': 'legenda', 'FOOTER_GENERATED': 'strona wygenerowana', - 'SWISS_DEFAULT_LABEL': 'Turniej o %d. miejsce' + 'SWISS_DEFAULT_LABEL': 'Turniej o %d. miejsce', + 'DETERMINED_TEAMS': 'Drużyny z pewnym miejscem w tej fazie:', + 'POSSIBLE_TEAMS': 'Drużyny z trwających meczów poprzedniej fazy:' } class PlayoffI18N(object): diff --git a/jfr_playoff/template.py b/jfr_playoff/template.py index 70c179b..5845498 100644 --- a/jfr_playoff/template.py +++ b/jfr_playoff/template.py @@ -24,6 +24,14 @@ class PlayoffTemplateStrings(object): %.1f ''' + MATCH_TEAM_LABEL = '<span class="team-label">%s</span>' + + MATCH_PREDICTED_TEAM_LABEL = '<span class="team-predicted-label">%s</span>' + + MATCH_TEAM_LIST_HEADER = '{{DETERMINED_TEAMS}}' + + MATCH_POSSIBLE_TEAM_LIST_HEADER = '{{POSSIBLE_TEAMS}}' + MATCH_TEAM_LINK = ''' <a href="%s" onmouseover="Tip('%s')" onmouseout="UnTip()">%s</a> ''' |