From 999f094004b802d93fc8c17c3939cadd792d08ec Mon Sep 17 00:00:00 2001 From: climu Date: Tue, 11 Jul 2023 11:16:04 +0200 Subject: [PATCH] iframe game view --- .../league/iframe/archives_games.html | 43 +++++++++ league/templates/league/iframe/games.html | 40 ++++++++ league/views.py | 9 +- openstudyroom/static/css/openstudyroom.css | 4 + openstudyroom/templates/iframe.html | 92 +++++++++++++++++++ 5 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 league/templates/league/iframe/archives_games.html create mode 100644 league/templates/league/iframe/games.html create mode 100644 openstudyroom/templates/iframe.html diff --git a/league/templates/league/iframe/archives_games.html b/league/templates/league/iframe/archives_games.html new file mode 100644 index 00000000..55a4e45a --- /dev/null +++ b/league/templates/league/iframe/archives_games.html @@ -0,0 +1,43 @@ +{% extends "iframe.html" %} +{% load league_tags wgo_tags l10n i18n static %} + +{% block title %}Archives - Games {% if sgf %}- {{sgf.black.username}} vs {{sgf.white.username}} {%endif %}{% endblock %} +{% block extra_head_js %} + +{% endblock %} + +{% block content %} + {% include "league/includes/game_table_view.html" %} +{% endblock %} + +{% block extra_css %} + + +{% endblock %} +{% block extra_js %} +{% include "league/includes/sgrfs_datatable.html" with sgfs_data_json=sgfs_data_json %} +{% endblock %} diff --git a/league/templates/league/iframe/games.html b/league/templates/league/iframe/games.html new file mode 100644 index 00000000..574ad754 --- /dev/null +++ b/league/templates/league/iframe/games.html @@ -0,0 +1,40 @@ +{% extends "iframe.html" %} +{% load tz static league_tags wgo_tags bootstrap3 l10n i18n%} + +{% block extra_head_js %} + +{% endblock %} +{% block content %} + +{% include "league/includes/game_table_view.html" with event=event %} +{% endblock %} + +{% block extra_js %} +{% get_current_language as LANGUAGE_CODE %} +{% include "league/includes/sgrfs_datatable.html" with sgfs_data_json=sgfs_data_json %} +{% endblock %} diff --git a/league/views.py b/league/views.py index 5a30bd6c..5dcbb502 100644 --- a/league/views.py +++ b/league/views.py @@ -277,16 +277,21 @@ def list_games(request, event_id=None, sgf_id=None): context.update({'sgf': sgf}) if event_id is None: - template = loader.get_template('league/archives_games.html') + template_path = 'league/archives_games.html' else: event = get_object_or_404(LeagueEvent, pk=event_id) - template = loader.get_template('league/games.html') + template_path = 'league/games.html' context.update({ 'event': event, 'can_join': event.can_join(request.user), 'can_quit': event.can_quit(request.user), }) + if request.GET.get('iframe'): + template_path = template_path.replace('league', 'league/iframe') + + template = loader.get_template(template_path) + return HttpResponse(template.render(context, request)) diff --git a/openstudyroom/static/css/openstudyroom.css b/openstudyroom/static/css/openstudyroom.css index 63d13d02..ed00f6d9 100644 --- a/openstudyroom/static/css/openstudyroom.css +++ b/openstudyroom/static/css/openstudyroom.css @@ -367,4 +367,8 @@ height: auto; } .slider { margin-top: 5em; +} + +body.iframe{ + padding: 0 !important; } \ No newline at end of file diff --git a/openstudyroom/templates/iframe.html b/openstudyroom/templates/iframe.html new file mode 100644 index 00000000..2abcf404 --- /dev/null +++ b/openstudyroom/templates/iframe.html @@ -0,0 +1,92 @@ +{% load static wagtailuserbar compress puput_tags %} +{% load menu_tags osr_tags tz calendar_tags%} +{% load bootstrap3 %} +{% load i18n %} + + + + + + + + + + + + + + + + {% if not debug %} + + + + + {% endif %} + + + {% block title %} + {% endblock %} + + + + {# Global stylesheets #} + {% bootstrap_css %} + + {% compress css %} + + + + {% endcompress %} + + + + + {% block extra_css %} + {# Override this in templates to add extra stylesheets #} + {% endblock %} + + {% block extra_head_js %} + {# Override this in templates to add extra stylesheets #} + {% endblock %} + + + + +
+{% block extra-header %}{% endblock %} +
+ + {% block content%} + {% endblock %} + + {% block main %}{% endblock %} + + {% get_current_timezone as TIME_ZONE %} + {% get_current_language as LANGUAGE_CODE %} + + + {# Global javascript #} + {% bootstrap_javascript %} + + + + + + + {% block extra_js %} + {# Override this in templates to add extra javascript #} + {% endblock %} + + {# for machina templates we needs a js block #} + {% block js %} + {% endblock %} + +