Commit 415fe8d3 by Andy Armstrong

Clean up the logic for the edit modal's title

parent dce075a8
......@@ -53,10 +53,7 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
onDisplayXBlock: function() {
var editorView = this.editorView,
displayName,
title;
displayName = editorView.getDisplayName();
title = interpolate(gettext("Editing: %(title)s"), { title: displayName }, true);
title = this.getTitle();
if (editorView.hasCustomTabs()) {
// Hide the modal's header as the custom editor provides its own
this.$('.modal-header').hide();
......@@ -72,6 +69,11 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
}
},
getTitle: function() {
var displayName = this.xblockElement.find('.component-header').text().trim();
return interpolate(gettext("Editing: %(title)s"), { title: displayName }, true);
},
addDefaultModes: function() {
var defaultModes = this.editorView.getDefaultModes(),
i,
......
......@@ -117,14 +117,6 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js
return data;
},
getDisplayName: function() {
var metadataEditor = this.getMetadataEditor();
if (metadataEditor) {
return metadataEditor.getDisplayName();
}
return "How do we get the display name now?";
},
/**
* Returns the metadata that has changed in the editor. This is a combination of the metadata
* modified in the "Settings" editor, as well as any custom metadata provided by the component.
......
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