fix: TNL-10267 video blocks load wrong editor (#31468)
* fix: video editor button redirect * fix: remove debugging statements * fix: remove unnecessary comments
This commit is contained in:
@@ -181,25 +181,30 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/views/pages/base_page
|
||||
},
|
||||
|
||||
editXBlock: function(event, options) {
|
||||
var xblockElement = this.findXBlockElement(event.target),
|
||||
self = this,
|
||||
modal = new EditXBlockModal(options);
|
||||
event.preventDefault();
|
||||
|
||||
if(!options || options.view !== 'visibility_view' ){
|
||||
var useNewTextEditor = this.$('.xblock-header-primary').attr("use-new-editor-text"),
|
||||
useNewVideoEditor = this.$('.xblock-header-primary').attr("use-new-editor-video"),
|
||||
useNewProblemEditor = this.$('.xblock-header-primary').attr("use-new-editor-problem"),
|
||||
blockType = xblockElement.find('.xblock').attr("data-block-type");
|
||||
const primaryHeader = $(event.target).closest('.xblock-header-primary')
|
||||
|
||||
var useNewTextEditor = primaryHeader.attr("use-new-editor-text"),
|
||||
useNewVideoEditor = primaryHeader.attr("use-new-editor-video"),
|
||||
useNewProblemEditor = primaryHeader.attr("use-new-editor-problem"),
|
||||
blockType = primaryHeader.attr("data-block-type");
|
||||
|
||||
if( (useNewTextEditor === "True" && blockType === "html") ||
|
||||
(useNewVideoEditor === "True" && blockType === "video") ||
|
||||
(useNewProblemEditor === "True" && blockType === "problem")
|
||||
) {
|
||||
var destinationUrl = this.$('.xblock-header-primary').attr("authoring_MFE_base_url") + '/' + blockType + '/' + encodeURI(xblockElement.find('.xblock').attr("data-usage-id"));
|
||||
var destinationUrl = primaryHeader.attr("authoring_MFE_base_url") + '/' + blockType + '/' + encodeURI(primaryHeader.attr("data-usage-id"));
|
||||
window.location.href = destinationUrl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var xblockElement = this.findXBlockElement(event.target),
|
||||
self = this,
|
||||
modal = new EditXBlockModal(options);
|
||||
|
||||
modal.edit(xblockElement, this.model, {
|
||||
readOnlyView: !this.options.canEdit,
|
||||
refresh: function() {
|
||||
|
||||
@@ -64,6 +64,8 @@ block_is_unit = is_unit(xblock)
|
||||
use-new-editor-video = ${use_new_editor_video}
|
||||
use-new-editor-problem = ${use_new_editor_problem}
|
||||
authoring_MFE_base_url = ${get_editor_page_base_url(xblock.location.course_key)}
|
||||
data-block-type = ${xblock.scope_ids.block_type}
|
||||
data-usage-id = ${xblock.scope_ids.usage_id}
|
||||
>
|
||||
<div class="header-details">
|
||||
% if show_inline:
|
||||
@@ -85,7 +87,7 @@ block_is_unit = is_unit(xblock)
|
||||
% if can_edit:
|
||||
% if not show_inline:
|
||||
<li class="action-item action-edit">
|
||||
<button class="btn-default edit-button action-button">
|
||||
<button class="btn-default edit-button action-button" data-usage-id=${xblock.scope_ids.usage_id}>
|
||||
<span class="icon fa fa-pencil" aria-hidden="true"></span>
|
||||
<span class="action-button-text">${_("Edit")}</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user