From 5465bda5f3e10efbcd59bb451e5ca2c84860c38a Mon Sep 17 00:00:00 2001 From: Peter Fogg <pfogg@dhcp-18-111-88-191.dyn.mit.edu> Date: Wed, 29 May 2013 17:00:25 -0400 Subject: [PATCH] Use MITX_FEATURES to tell if we're in the CMS; this is much cleaner. Also use $.data instead of a hidden div. --- cms/envs/common.py | 5 ++++- .../xmodule/js/src/video/display/video_player.coffee | 2 +- common/lib/xmodule/xmodule/video_module.py | 3 +-- lms/templates/video.html | 8 +------- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 90e15186d74..3f322b50017 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -40,7 +40,10 @@ MITX_FEATURES = { 'SEGMENT_IO': True, # Enable URL that shows information about the status of various services - 'ENABLE_SERVICE_STATUS': False + 'ENABLE_SERVICE_STATUS': False, + + # We're in the CMS. + 'IN_CMS': True } ENABLE_JASMINE = False diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee index f02386dc43a..47f822bd927 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee @@ -66,7 +66,7 @@ class @VideoPlayer extends Subview at: 'top center' onReady: (event) => - unless onTouchBasedDevice() or $('#in_lms').hasClass('false') + unless onTouchBasedDevice() or $('.video:first').data('in-cms') $('.video-load-complete:first').data('video').player.play() onStateChange: (event) => diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 9e2ca892e26..f902a9665be 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -139,8 +139,7 @@ class VideoModule(VideoFields, XModule): 'show_captions': self.show_captions, 'start': self.start_time, 'end': self.end_time, - 'normal_speed_video_id': normal_speed_video_id, - 'in_lms': not self.system.debug + 'normal_speed_video_id': normal_speed_video_id }) diff --git a/lms/templates/video.html b/lms/templates/video.html index 558c7acec27..0bbcf046cdd 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -16,7 +16,7 @@ width="640" height="390"></embed> </object> %else: - <div id="video_${id}" class="video" data-streams="${streams}" data-show-captions="${show_captions}" data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}"> + <div id="video_${id}" class="video" data-streams="${streams}" data-show-captions="${show_captions}" data-start="${start}" data-end="${end}" data-caption-asset-path="${caption_asset_path}" data-in-cms="${settings.MITX_FEATURES.get('IN_CMS', False)}"> <div class="tc-wrapper"> <article class="video-wrapper"> <section class="video-player"> @@ -39,9 +39,3 @@ <p>Download subtitles <a href="${track}">here</a>.</p> </div> % endif - -%if in_lms: -<div id="in_lms" class="true" style="display: none;"></div> -%else: -<div id="in_lms" class="false" style="display: none;"></div> -%endif -- GitLab