Commit 2cea81b0 by Alexander Kryklia

Merge pull request #2620 from edx/alex/fix_enable_download_track

Enable download_track for existing courses if self.track.
parents acad35bb 23a2177d
......@@ -351,6 +351,13 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
if not download_video['explicitly_set']:
self.download_video = True
# for backward compatibility.
# If course was existed and was not re-imported by the moment of adding `download_track` field,
# we should enable `download_track` if following is true:
download_track = editable_fields['download_track']
if not download_track['explicitly_set'] and self.track:
self.download_track = True
@property
def editable_metadata_fields(self):
editable_fields = super(VideoDescriptor, self).editable_metadata_fields
......
......@@ -420,13 +420,23 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
'display_name': 'Download Transcript',
'help': 'The external URL to download the timed transcript track.',
'type': 'Generic',
'value': u'',
'value': u'http://some_track.srt',
'field_name': 'track',
'options': [],
},
'download_track': {
'default_value': False,
'explicitly_set': False,
'display_name': 'Transcript Download Allowed',
'help': 'Show a link beneath the video to allow students to download the transcript. Note: You must add a link to the HTML5 Transcript field above.',
'type': 'Generic',
'value': False,
'field_name': 'download_track',
'options': [],
}
}
metadata = {
'track': None,
'track': u'http://some_track.srt',
'source': 'http://example.org/video.mp4',
'html5_sources': ['http://youtu.be/OEoXaMPEzfM.mp4'],
}
......@@ -437,6 +447,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
self.assertIn('source', fields)
self.assertFalse(self.item_module.download_video)
self.assertTrue(self.item_module.source_visible)
self.assertTrue(self.item_module.download_track)
def test_source_is_empty(self):
metadata = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment