From 415fe8d3960664ab1be57164ef2aa9201a9e2710 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 2 Apr 2014 17:24:29 -0400 Subject: [PATCH] Clean up the logic for the edit modal's title --- cms/static/js/views/modals/edit_xblock.js | 10 ++++++---- cms/static/js/views/xblock_editor.js | 8 -------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cms/static/js/views/modals/edit_xblock.js b/cms/static/js/views/modals/edit_xblock.js index d11681fd92..c583e12e41 100644 --- a/cms/static/js/views/modals/edit_xblock.js +++ b/cms/static/js/views/modals/edit_xblock.js @@ -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, diff --git a/cms/static/js/views/xblock_editor.js b/cms/static/js/views/xblock_editor.js index 88911b2510..2a173d661a 100644 --- a/cms/static/js/views/xblock_editor.js +++ b/cms/static/js/views/xblock_editor.js @@ -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.