Currently, when there is a YouTube URL configured on the track, we automatically set the layout of the track page as "widescreen". This implies that we hide some menus and adapt the layout to display the full video player. However, in the XML template of the track view, we only display the video player if there is a YouTube URL configured AND one or more of those conditions is respected: - The track is configured as a "YouTube Replay" - The track is "coming soon" (< 30 minutes) - The track is live - The track is done This is done to match the two behaviors and get a consistent display. Task-2643147 closes odoo/odoo#76296 X-original-commit: bfb692dd5c6480841d5c6fb1e54dba1b4bd928ab Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import re
|
|
|
|
from odoo.addons.website_event_track.controllers.event_track import EventTrackController
|
|
from odoo.http import request
|
|
|
|
|
|
class WebsiteEventSessionLiveController(EventTrackController):
|
|
|
|
def _event_track_page_get_values(self, event, track, **options):
|
|
if 'widescreen' not in options:
|
|
options['widescreen'] = track.youtube_video_url and (track.is_youtube_replay or track.is_track_soon or track.is_track_live or track.is_track_done)
|
|
values = super(WebsiteEventSessionLiveController, self)._event_track_page_get_values(event, track, **options)
|
|
# Youtube disables the chat embed on all mobile devices
|
|
# This regex is a naive attempt at matching their behavior (should work for most cases)
|
|
values['is_mobile_chat_disabled'] = bool(re.match(
|
|
r'^.*(Android|iPad|iPhone).*',
|
|
request.httprequest.headers.get('User-Agent', request.httprequest.headers.get('user-agent', ''))))
|
|
return values
|