fix: hide download urls and fix margin for video embed view (#31784)

* fix: hide all download links if embed

* style: remove embed margin

* test: fix failing video context tests
This commit is contained in:
Jansen Kantor
2023-02-16 21:17:03 -05:00
committed by GitHub
parent b85929e2ee
commit dc7c74e890
4 changed files with 15 additions and 3 deletions

View File

@@ -92,6 +92,7 @@ class TestVideoYouTube(TestVideo): # lint-amnesty, pylint: disable=missing-clas
'download_video_link': 'example.mp4',
'handout': None,
'id': self.item_descriptor.location.html_id(),
'is_embed': False,
'metadata': json.dumps(OrderedDict({
'autoAdvance': False,
'saveStateEnabled': True,
@@ -172,6 +173,7 @@ class TestVideoNonYouTube(TestVideo): # pylint: disable=test-inherits-tests
'display_name': 'A Name',
'download_video_link': 'example.mp4',
'handout': None,
'is_embed': False,
'id': self.item_descriptor.location.html_id(),
'metadata': json.dumps(OrderedDict({
'autoAdvance': False,
@@ -342,6 +344,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'download_video_link': 'example.mp4',
'handout': None,
'id': self.item_descriptor.location.html_id(),
'is_embed': False,
'metadata': '',
'track': None,
'transcript_download_format': 'srt',
@@ -460,6 +463,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'download_video_link': 'example.mp4',
'handout': None,
'id': self.item_descriptor.location.html_id(),
'is_embed': False,
'metadata': self.default_metadata_dict,
'track': None,
'transcript_download_format': 'srt',
@@ -584,6 +588,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'display_name': 'A Name',
'download_video_link': 'example.mp4',
'handout': None,
'is_embed': False,
'id': self.item_descriptor.location.html_id(),
'track': None,
'transcript_download_format': 'srt',
@@ -755,6 +760,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'display_name': 'A Name',
'download_video_link': 'example.mp4',
'handout': None,
'is_embed': False,
'id': self.item_descriptor.location.html_id(),
'track': None,
'transcript_download_format': 'srt',
@@ -866,6 +872,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'display_name': 'A Name',
'download_video_link': None,
'handout': None,
'is_embed': False,
'id': None,
'metadata': self.default_metadata_dict,
'track': None,
@@ -961,6 +968,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
'download_video_link': None,
'handout': None,
'id': None,
'is_embed': False,
'metadata': self.default_metadata_dict,
'track': None,
'transcript_download_format': 'srt',
@@ -2198,6 +2206,7 @@ class TestVideoWithBumper(TestVideo): # pylint: disable=test-inherits-tests
'display_name': 'A Name',
'download_video_link': 'example.mp4',
'handout': None,
'is_embed': False,
'id': self.item_descriptor.location.html_id(),
'metadata': json.dumps(OrderedDict({
'autoAdvance': False,
@@ -2272,6 +2281,7 @@ class TestAutoAdvanceVideo(TestVideo): # lint-amnesty, pylint: disable=test-inh
'display_name': 'A Name',
'download_video_link': 'example.mp4',
'handout': None,
'is_embed': False,
'id': self.item_descriptor.location.html_id(),
'bumper_metadata': 'null',
'metadata': json.dumps(OrderedDict({

View File

@@ -101,6 +101,7 @@ from openedx.core.djangolib.markup import HTML
.xmodule_display.xmodule_VideoBlock .video {
padding: 0;
margin: 0;
}
</style>
</head>

View File

@@ -6,7 +6,7 @@ from openedx.core.djangolib.js_utils import (
dump_js_escaped_json, js_escaped_string
)
%>
% if display_name is not UNDEFINED and display_name is not None:
% if display_name is not UNDEFINED and display_name is not None and not is_embed:
<h3 class="hd hd-2">${display_name}</h3>
% endif
@@ -46,7 +46,7 @@ from openedx.core.djangolib.js_utils import (
<div class="focus_grabber last"></div>
% if download_video_link or track or handout or branding_info:
% if (download_video_link or track or handout or branding_info) and not is_embed:
<h3 class="hd hd-4 downloads-heading sr" id="video-download-transcripts_${id}">${_('Downloads and transcripts')}</h3>
<div class="wrapper-downloads" role="region" aria-labelledby="video-download-transcripts_${id}">
% if download_video_link:

View File

@@ -461,10 +461,11 @@ class VideoBlock(
'bumper_metadata': json.dumps(self.bumper['metadata']), # pylint: disable=E1101
'cdn_eval': cdn_eval,
'cdn_exp_group': cdn_exp_group,
'display_name': None if is_embed else self.display_name_with_default,
'display_name': self.display_name_with_default,
'download_video_link': download_video_link,
'handout': self.handout,
'id': self.location.html_id(),
'is_embed': is_embed,
'license': getattr(self, "license", None),
'metadata': json.dumps(OrderedDict(metadata)),
'poster': json.dumps(get_poster(self)),