From 8fd15ce45d6a29019a2704c35a5138fca0574eb1 Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 30 May 2013 14:13:10 -0400 Subject: [PATCH] Review feedback. --- .../features/component_settings_editor_helpers.py | 2 +- .../contentstore/features/discussion-editor.py | 2 +- cms/djangoapps/contentstore/features/html-editor.py | 2 +- .../contentstore/features/problem-editor.py | 2 +- .../contentstore/features/video-editor.py | 2 +- cms/static/js/models/metadata_model.js | 12 ++++++++---- cms/static/js/views/metadata_editor_view.js | 13 +++++++------ cms/templates/js/metadata-number-entry.underscore | 6 +++--- cms/templates/js/metadata-option-entry.underscore | 6 +++--- cms/templates/js/metadata-string-entry.underscore | 6 +++--- common/lib/xmodule/xmodule/tests/test_xml_module.py | 2 +- 11 files changed, 30 insertions(+), 25 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 347421fca8..ee684e53dc 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world from nose.tools import assert_equal diff --git a/cms/djangoapps/contentstore/features/discussion-editor.py b/cms/djangoapps/contentstore/features/discussion-editor.py index 87a9c47e77..aced4c2c88 100644 --- a/cms/djangoapps/contentstore/features/discussion-editor.py +++ b/cms/djangoapps/contentstore/features/discussion-editor.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step diff --git a/cms/djangoapps/contentstore/features/html-editor.py b/cms/djangoapps/contentstore/features/html-editor.py index 8d95ffd6b1..054c0ea642 100644 --- a/cms/djangoapps/contentstore/features/html-editor.py +++ b/cms/djangoapps/contentstore/features/html-editor.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step diff --git a/cms/djangoapps/contentstore/features/problem-editor.py b/cms/djangoapps/contentstore/features/problem-editor.py index 27fe5fcec8..3a61603f28 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.py +++ b/cms/djangoapps/contentstore/features/problem-editor.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step from nose.tools import assert_equal diff --git a/cms/djangoapps/contentstore/features/video-editor.py b/cms/djangoapps/contentstore/features/video-editor.py index 95b151126a..d894db2e0f 100644 --- a/cms/djangoapps/contentstore/features/video-editor.py +++ b/cms/djangoapps/contentstore/features/video-editor.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world, step diff --git a/cms/static/js/models/metadata_model.js b/cms/static/js/models/metadata_model.js index a3f8136376..fd726619d4 100644 --- a/cms/static/js/models/metadata_model.js +++ b/cms/static/js/models/metadata_model.js @@ -60,8 +60,10 @@ CMS.Models.Metadata = Backbone.Model.extend({ * Sets the displayed value. */ setValue: function (value) { - this.set('explicitly_set', true); - this.set('value', value); + this.set({ + explicitly_set: true, + value: value + }); }, /** @@ -93,8 +95,10 @@ CMS.Models.Metadata = Backbone.Model.extend({ * explicitly_set property. */ clear: function() { - this.set('explicitly_set', false); - this.set('value', this.get('default_value')); + this.set({ + explicitly_set: false, + value: this.get('default_value') + }); } }); diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index 8994cff010..3dba326042 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -89,6 +89,7 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({ } this.template = _.template(tpl); this.$el.append(this.template({model: this.model, uniqueId: this.uniqueId})); + this.listenTo(this.model, 'change', this.render); this.render(); }, @@ -108,21 +109,17 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({ setValueInEditor : function (value) {}, /** - * Sets the value in the model, using the value currently displayed in the view. Afterward, - * this method re-renders to update the clear button. + * Sets the value in the model, using the value currently displayed in the view. */ updateModel: function () { this.model.setValue(this.getValueFromEditor()); - this.render(); }, /** - * Clears the value currently set in the model (reverting to the default). Afterward, this method - * re-renders the view. + * Clears the value currently set in the model (reverting to the default). */ clear: function () { this.model.clear(); - this.render(); }, /** @@ -160,6 +157,8 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({ this.getClearButton().addClass('inactive'); this.getClearButton().removeClass('active'); } + + return this; } }); @@ -229,6 +228,8 @@ CMS.Views.Metadata.Number = CMS.Views.Metadata.AbstractEditor.extend({ this.initialized = true; } + + return this; }, templateName: "metadata-number-entry", diff --git a/cms/templates/js/metadata-number-entry.underscore b/cms/templates/js/metadata-number-entry.underscore index ed233214d8..333233ef4e 100644 --- a/cms/templates/js/metadata-number-entry.underscore +++ b/cms/templates/js/metadata-number-entry.underscore @@ -1,8 +1,8 @@
- +
<%= model.get('help') %> diff --git a/cms/templates/js/metadata-option-entry.underscore b/cms/templates/js/metadata-option-entry.underscore index 1d2351dab9..4cb107e882 100644 --- a/cms/templates/js/metadata-option-entry.underscore +++ b/cms/templates/js/metadata-option-entry.underscore @@ -2,15 +2,15 @@ - <%= model.get('help') %> diff --git a/cms/templates/js/metadata-string-entry.underscore b/cms/templates/js/metadata-string-entry.underscore index 60b1f306df..759e3ad826 100644 --- a/cms/templates/js/metadata-string-entry.underscore +++ b/cms/templates/js/metadata-string-entry.underscore @@ -1,8 +1,8 @@
- +
<%= model.get('help') %> diff --git a/common/lib/xmodule/xmodule/tests/test_xml_module.py b/common/lib/xmodule/xmodule/tests/test_xml_module.py index 8f302194a6..dd59ca2b48 100644 --- a/common/lib/xmodule/xmodule/tests/test_xml_module.py +++ b/common/lib/xmodule/xmodule/tests/test_xml_module.py @@ -1,5 +1,5 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from xmodule.x_module import XModuleFields from xblock.core import Scope, String, Object, Boolean