fix: open mfe modal editor of new duplicated xblock (#36641)
When duplicating an xblock in the authoring MFE, the iframe was opening its own editor modal instead of the MFE modal.
This commit is contained in:
committed by
GitHub
parent
1002f5f91b
commit
c20e6ec7f3
@@ -29,6 +29,7 @@ class CourseWaffleFlagsSerializer(serializers.Serializer):
|
||||
use_new_group_configurations_page = serializers.SerializerMethodField()
|
||||
enable_course_optimizer = serializers.SerializerMethodField()
|
||||
use_react_markdown_editor = serializers.SerializerMethodField()
|
||||
use_video_gallery_flow = serializers.SerializerMethodField()
|
||||
|
||||
def get_course_key(self):
|
||||
"""
|
||||
@@ -160,3 +161,9 @@ class CourseWaffleFlagsSerializer(serializers.Serializer):
|
||||
"""
|
||||
course_key = self.get_course_key()
|
||||
return toggles.use_react_markdown_editor(course_key)
|
||||
|
||||
def get_use_video_gallery_flow(self, obj):
|
||||
"""
|
||||
Method to get the use_video_gallery_flow waffle flag
|
||||
"""
|
||||
return toggles.use_video_gallery_flow()
|
||||
|
||||
@@ -61,8 +61,9 @@ class CourseWaffleFlagsView(APIView):
|
||||
"use_new_course_team_page": true,
|
||||
"use_new_certificates_page": true,
|
||||
"use_new_textbooks_page": true,
|
||||
"use_new_group_configurations_page": true
|
||||
"use_new_group_configurations_page": true,
|
||||
"use_react_markdown_editor": true,
|
||||
"use_video_gallery_flow": true
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
@@ -34,6 +34,7 @@ class CourseWaffleFlagsViewTest(CourseTestCase):
|
||||
'use_new_updates_page': True,
|
||||
'use_new_video_uploads_page': False,
|
||||
'use_react_markdown_editor': False,
|
||||
'use_video_gallery_flow': False,
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -64,6 +64,8 @@ function($, _, Backbone, gettext, BasePage,
|
||||
this.isLibraryPage = this.model.attributes.category === 'library';
|
||||
this.isLibraryContentPage = this.model.attributes.category === 'library_content';
|
||||
this.isSplitTestContentPage = this.model.attributes.category === 'split_test';
|
||||
this.isVerticalContentPage = this.model.attributes.category === 'vertical';
|
||||
|
||||
this.nameEditor = new XBlockStringFieldEditor({
|
||||
el: this.$('.wrapper-xblock-field'),
|
||||
model: this.model
|
||||
@@ -160,6 +162,9 @@ function($, _, Backbone, gettext, BasePage,
|
||||
case 'completeManageXBlockAccess':
|
||||
this.refreshXBlock(xblockElement, false);
|
||||
break;
|
||||
case 'completeXBlockDuplicating':
|
||||
this.refreshXBlock(xblockElement, true, true);
|
||||
break;
|
||||
case 'completeXBlockMoving':
|
||||
xblockWrapper.hide();
|
||||
break;
|
||||
@@ -1153,15 +1158,7 @@ function($, _, Backbone, gettext, BasePage,
|
||||
|| (useNewVideoEditor === 'True' && blockType.includes('video'))
|
||||
|| (useNewProblemEditor === 'True' && blockType.includes('problem')))
|
||||
){
|
||||
var destinationUrl;
|
||||
if (useVideoGalleryFlow === 'True' && blockType.includes('video')) {
|
||||
destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/course-videos/' + encodeURI(data.locator);
|
||||
}
|
||||
else {
|
||||
destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/' + blockType[1] + '/' + encodeURI(data.locator);
|
||||
}
|
||||
|
||||
if (this.options.isIframeEmbed && this.isSplitTestContentPage) {
|
||||
if (this.options.isIframeEmbed && (this.isSplitTestContentPage || this.isVerticalContentPage)) {
|
||||
return this.postMessageToParent({
|
||||
type: 'handleRedirectToXBlockEditPage',
|
||||
message: 'Redirect to xBlock edit page',
|
||||
@@ -1171,7 +1168,13 @@ function($, _, Backbone, gettext, BasePage,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
var destinationUrl;
|
||||
if (useVideoGalleryFlow === 'True' && blockType.includes('video')) {
|
||||
destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/course-videos/' + encodeURI(data.locator);
|
||||
}
|
||||
else {
|
||||
destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/' + blockType[1] + '/' + encodeURI(data.locator);
|
||||
}
|
||||
window.location.href = destinationUrl;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user